1/*! 2 * jQuery Sticky Footer 1.1 3 * Corey Snyder 4 * http://tangerineindustries.com 5 * 6 * Released under the MIT license 7 * 8 * Copyright 2013 Corey Snyder. 9 * 10 * Date: Thu Jan 22 2013 13:34:00 GMT-0630 (Eastern Daylight Time) 11 * Modification for jquery 1.9+ Tue May 7 2013 12 * Modification for non-jquery, removed all, now classic JS Wed Jun 12 2013 13 */ 14 15window.onload = function() { 16 stickyFooter(); 17 18 // you can either uncomment and allow the setInterval to auto correct the 19 // footer 20 // or call stickyFooter() if you have major DOM changes 21 // setInterval(checkForDOMChange, 1000); 22}; 23 24// check for changes to the DOM 25function checkForDOMChange() { 26 stickyFooter(); 27} 28 29//check for resize event if not IE 9 or greater 30window.onresize = function() { 31 stickyFooter(); 32} 33 34//lets get the marginTop for the <footer> 35function getCSS(element, property) { 36 37 var elem = document.getElementsByTagName(element)[0]; 38 var css = null; 39 40 if (elem.currentStyle) { 41 css = elem.currentStyle[property]; 42 43 } else if (window.getComputedStyle) { 44 css = document.defaultView.getComputedStyle(elem, null) 45 .getPropertyValue(property); 46 } 47 48 return css; 49 50} 51 52function stickyFooter() { 53 54 if (document.getElementsByTagName("footer")[0].getAttribute("style") != null) { 55 document.getElementsByTagName("footer")[0].removeAttribute("style"); 56 } 57 58 if (window.innerHeight != document.body.offsetHeight) { 59 var offset = window.innerHeight - document.body.offsetHeight; 60 var current = getCSS("footer", "margin-top"); 61 62 if (isNaN(current) == true) { 63 document.getElementsByTagName("footer")[0].setAttribute("style", 64 "margin-top:0px;"); 65 current = 0; 66 } else { 67 current = parseInt(current); 68 } 69 70 if (current + offset > parseInt(getCSS("footer", "margin-top"))) { 71 document.getElementsByTagName("footer")[0].setAttribute("style", 72 "margin-top:" + (current + offset) + "px;"); 73 } 74 } 75} 76 77$(window).load( function() { 78 stickyFooter(); 79}); 80 81$(window).resize( function() { 82 stickyFooter(); 83}); 84 85function stickyFooter() { 86 $("footer").removeAttr('style'); 87 if (window.innerHeight != document.body.offsetHeight) { 88 var offset = window.innerHeight - document.body.offsetHeight; 89 var current = parseInt($("footer").css("margin-top")); 90 91 if (current + offset > parseInt($("footer").css("margin-top"))) { 92 $("footer").css( { 93 "margin-top" : (current + offset) + "px" 94 }); 95 } 96 } 97} 98/* 99 ! end sticky footer 100 */ 101 102/* 103 * 104 * If you want to delay the window resize event 105 * 106 * $(window).load(function() { stickyFooter(); }); 107 * 108 * $(window).resize(function () { delay(function() { stickyFooter(); }, 500); 109 * }); 110 * 111 * var delay = (function(){ var timer = 0; return function(callback, ms) { 112 * clearTimeout (timer); timer = setTimeout(callback, ms); }; })(); 113 * 114 * function stickyFooter() { $("footer").removeAttr('style'); if 115 * (window.innerHeight != document.body.offsetHeight) { var offset = 116 * window.innerHeight - document.body.offsetHeight; var current = 117 * parseInt($("footer").css("margin-top")); 118 * 119 * if (current+offset > parseInt($("footer").css("margin-top"))) { 120 * $("footer").css({"margin-top":(current+offset)+"px"}); } } } 121 * 122 */
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.