I have implemented $. inside a plugin in which you can specify ancestor , in your case:
$('html').css('height', '100%'); // make `html` the height of the viewport $('#your-element').inside('html'); // compare `#your-element` to `html`
will return for example:
{ left: 0.2, // your element is "x-inside" (because >0 and <1) top: -2.3 // but is not "y-inside" (because <0) }
Read more in README.
In your case, you can add an extra check for is(':hidden') and z-index
Hope this helps.
abernier
source share