$el.inside( <ancestor> [, <includeMargin>] )
<ancestor>: The ancestor to compare $el with
'selector' | jQuery | node
<includeMargin>: Whether to take margins into account
{
left: <left>
top: <top>
}
<left|top>: Position of $el to <ancestor>
+-----+ +-----+
| 0/0 | | 1/0 |
+-----+ +-----+
+-----------------+
| +-----+ |
| |.5/.5| |
| +-----+ |
+-----------------+
+-----+ +-----+
| 0/1 | | 1/1 |
+-----+ +-----+
Determine if an element is in the viewport — and how far:
$('#foo').inside('html');
$(el).bind('inside', {ancestor: 'html'}, function (e, inside) {
// inside.left
// inside.top
});
Modified http://code.jquery.com/jquery-1.7.2.min.js to a secure url
https://code.jquery.com/jquery-1.7.2.min.js
https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js