2

I am reading the code of a plugin and trying to learn from it, but found something I don't understand:

Why is the author setting the visibility of select, embed and object to "hidden" in the start function and then resetting them to "visible" in the end function? The logic of the plugin doesn't deal with any of these tags, it is a lightbox plugin which attaches events to div and img elements.

$('select, object, embed').css({
    visibility: "hidden"
});

https://github.com/lokesh/lightbox2/blob/master/js/lightbox.js#L126

Then after:

$('select, object, embed').css({
    visibility: "visible"
});

I don't have any tags of these kinds on my website and I don't understand why a plugin user would have to hide these elements even if they had them.
Why is the plugin doing this?

Answer: Comment of A.Wolff

mskfisher
  • 3,291
  • 4
  • 35
  • 48
Adib Aroui
  • 4,981
  • 5
  • 42
  • 94
  • so why not just email the author? – Banana May 09 '15 at 12:57
  • 4
    I guess this is to avoid some bug in older IE where SELECT/OBJECT/EMBED elements were still visible on screen even overlapped by any other element (z-index bug) – A. Wolff May 09 '15 at 12:59
  • 2
    @Banana, why communities are created? what will gauranty author will answer me?is author obliged to answer any email privately? .....Many people are reading now A.Wollf interesting remark – Adib Aroui May 09 '15 at 13:01
  • @whitelettersandblankspaces because the best possible way to understand a plugin is to ask the person who created it. no, he is not obliged to answer you, but you can try - who knows, maybe you will get an answer. im just saying it as im reading the code and thinking maybe its best to ask the person who actually wrote it... – Banana May 09 '15 at 13:05
  • @Banana, I see. I believe the most appropriate person to answer this question is plugin author, but anyway SO was also a good quick starting place to read about z-index bug in IE. thank you for your time – Adib Aroui May 09 '15 at 13:09
  • You have to read [**this tutorial**](http://www.w3schools.com/css/css_display_visibility.asp) or to check [**this question**](http://stackoverflow.com/questions/133051/what-is-the-difference-between-visibilityhidden-and-displaynone) – SaidbakR May 09 '15 at 20:09
  • @sємsєм, thank you for the links and time – Adib Aroui May 09 '15 at 20:12
  • 1
    possible duplicate of [I am going crazy. Select box inside a dropdown menu div makes my dropdown menu div disappear when I use the select box -- how do I stop this?](http://stackoverflow.com/questions/6032714/i-am-going-crazy-select-box-inside-a-dropdown-menu-div-makes-my-dropdown-menu-d) – Paul Sweatte Jul 30 '15 at 18:27

0 Answers0