Jquery .show() not revealing a div with visibility of hidden

后端 未结 6 1923
情深已故
情深已故 2020-11-29 05:36

Basic jQuery question:

I am trying to reveal a div that has been marked as hidden using jQuery. But am not quite getting it

I\'ve created a JSFi

6条回答
  •  北荒
    北荒 (楼主)
    2020-11-29 06:14

    According to JQuery documentation .show() "is roughly equivalent to calling .css('display', 'block'), except that the display property is restored to whatever it was initially." Set the style explicitly instead. You could use a CSS class

    .hidden{
        visibility: hidden;
    }
    .shown{
        visibility: visible;
    }
    

    and set is using

    $("#yourdiv").removeClass("hidden").addClass("shown");
    

提交回复
热议问题