1(function($) { 2 3 /** 4 * Copyright 2012, Digital Fusion 5 * Licensed under the MIT license. 6 * http://teamdf.com/jquery-plugins/license/ 7 * 8 * @author Sam Sehnert 9 * @desc A small plugin that checks whether elements are within 10 * the user visible viewport of a web browser. 11 * only accounts for vertical position, not horizontal. 12 */ 13 14 $.fn.visible = function(partial) { 15 16 var $t = $(this), 17 $w = $(window), 18 viewTop = $w.scrollTop(), 19 viewBottom = viewTop + $w.height(), 20 _top = $t.offset().top, 21 _bottom = _top + $t.height(), 22 compareTop = partial === true ? _bottom : _top, 23 compareBottom = partial === true ? _top : _bottom; 24 25 return ((compareBottom <= viewBottom) && (compareTop >= viewTop)); 26 27 }; 28 29 })(jQuery); 30 31 var win = jQuery(window); 32 33 var allMods = jQuery(".fade-section"); 34 35 allMods.each(function(i, el) { 36 var el = jQuery(el); 37 if (el.visible(true)) { 38 el.addClass("already-visible"); 39 if(el.hasClass('body-vid')){ 40 var id = el.find('video').attr('id'); 41 if(id){ 42 var video = document.getElementById(id); 43 video.play(); 44 } 45 } 46 } 47 }); 48 49 win.on("load", function() { 50 allMods.each(function(i, el) { 51 var el = jQuery(el); 52 if (el.visible(true)) { 53 el.addClass("come-in"); 54 if(el.hasClass('body-vid')){ 55 var id = el.find('video').attr('id'); 56 if(id){ 57 var video = document.getElementById(id); 58 video.play(); 59 } 60 } 61 } 62 }); 63 }); 64 65 win.scroll(function(event) { 66 67 allMods.each(function(i, el) { 68 var el = jQuery(el); 69 if (el.visible(true)) { 70 el.addClass("come-in"); 71 if(el.hasClass('body-vid')){ 72 var id = el.find('video').attr('id'); 73 if(id){ 74 var video = document.getElementById(id); 75 video.play(); 76 } 77 } 78 } 79 }); 80 81 }); 82
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.