2 * @author Laurence Wheway
3 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
4 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
10 isOnScreen: function(box, container) {
11 //ensure numbers come in as intgers (not strings) and remove 'px' is it's there
12 for(var i in box){box[i] = parseFloat(box[i])};
13 for(var i in container){container[i] = parseFloat(container[i])};
17 left: $(window).scrollLeft(),
18 top: $(window).scrollTop(),
19 width: $(window).width(),
20 height: $(window).height()
24 if( box.left+box.width-container.left > 0 &&
25 box.left < container.width+container.left &&
26 box.top+box.height-container.top > 0 &&
27 box.top < container.height+container.top
34 jQuery.fn.isOnScreen = function (container) {
35 for(var i in container){container[i] = parseFloat(container[i])};
39 left: $(window).scrollLeft(),
40 top: $(window).scrollTop(),
41 width: $(window).width(),
42 height: $(window).height()
46 if( $(this).offset().left+$(this).width()-container.left > 0 &&
47 $(this).offset().left < container.width+container.left &&
48 $(this).offset().top+$(this).height()-container.top > 0 &&
49 $(this).offset().top < container.height+container.top