Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery: if my css visibility:hidden, how can i appear my elements?

in my css i've set some elements visibiliy:hidden, how can I show them?

I've done it before with opacity, but i've some bug in IE:

var i = 0;
$mySelection.each(function(i) {
    $(this).delay((i * 100) + ($mySelection.length)).animate(
        { opacity: "1"},
        {queue:true, duration:1000, easing:"quartEaseIn"}
    ); 
})

How can i do if I want controll visibility with jQuery instead of opacity? thank you

like image 893
davidino Avatar asked Dec 08 '10 13:12

davidino


People also ask

Which jQuery filter can be used to check if element is visible?

Answer: Use the jQuery :visible Selector You can use the jQuery :visible selector to check whether an element is visible in the layout or not. This selector will also select the elements with visibility: hidden; or opacity: 0; , because they preserve space in the layout even they are not visible to the eye.

How do I set visibility visible in jQuery?

visible = function() { return this. each(function() { $(this). css("visibility", "visible"); }); }; }(jQuery));

Can you click on a visibility hidden element?

No. An element such as a hyperlink can't be clicked (and the link followed) if the visibility is set to hidden.


2 Answers

$(":hidden").css("visibility", "visible");
like image 56
karim79 Avatar answered Sep 17 '22 12:09

karim79


Rather than using visibility: hidden, use display:none, then if you want to fade in your hidden element use fadeIn. For example:

$("div:hidden").fadeIn("slow");

Edit: Given that you want to use visibility, try this:

var i = 0;
$mySelection.each(function(i) {
    $(this).delay((i * 100) + ($mySelection.length)).css(
        { 'opacity': '0', 'visibility': 'visible'}).animate(
            { opacity: "1"},
            {queue:true, duration:1000, easing:"quartEaseIn"});
});
like image 27
cspolton Avatar answered Sep 17 '22 12:09

cspolton