How does jQuery implement hide() and show()

前端 未结 2 594
醉酒成梦
醉酒成梦 2021-02-04 23:47

Do they set display: none or visibility: hidden?

I\'m pretty sure display: none takes the element out of the normal flow, whilst <

相关标签:
2条回答
  • 2021-02-05 00:09

    It uses display, and for this type of thing you can use Firebug to actually examine what happens to the DOM.

    0 讨论(0)
  • 2021-02-05 00:26

    It uses display.

    Edit: And from John Sheehan's comment on this answer, which I agree with:

    You should go view the unpacked source anyway just to familiarize yourself with it

    Edit 2: Comments have mentioned using Firebug to discover what is happening. Indeed, I actually went to the jQuery docs and used the Safari Web Inspector to see what happened on the hide() demo to be sure of my answer.

    0 讨论(0)
提交回复
热议问题