Advertisement
Guest User

Untitled

a guest
Dec 26th, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1.  
  2. jQuery(document).foundation();
  3. var pathname = location.pathname;
  4. var styleEl = 'margin';
  5. if(pathname != '/bobdesign/steigerscorporation/' && pathname != '/'){
  6.  
  7.  
  8. window.onload = function() {
  9. stickyFooter();
  10.  
  11. //you can either uncomment and allow the setInterval to auto correct the footer
  12. //or call stickyFooter() if you have major DOM changes
  13. //setInterval(checkForDOMChange, 1000);
  14. };
  15.  
  16.  
  17. function checkForDOMChange() {
  18. stickyFooter();
  19. }
  20.  
  21. window.onresize = function() {
  22. stickyFooter();
  23. }
  24.  
  25.  
  26. function getCSS(element, property) {
  27.  
  28. var elem = document.getElementsByTagName(element)[0];
  29. var css = null;
  30.  
  31. if (elem.currentStyle) {
  32. css = elem.currentStyle[property];
  33.  
  34. } else if (window.getComputedStyle) {
  35. css = document.defaultView.getComputedStyle(elem, null).
  36. getPropertyValue(property);
  37. }
  38.  
  39. return css;
  40.  
  41. }
  42.  
  43. function stickyFooter() {
  44.  
  45. if (document.getElementsByTagName("footer")[0].getAttribute("style") != null) {
  46. document.getElementsByTagName("footer")[0].removeAttribute("style");
  47. }
  48.  
  49. if (window.innerHeight != document.body.offsetHeight) {
  50. var offset = window.innerHeight - document.body.offsetHeight;
  51. var current = getCSS("footer", styleEl+"-top");
  52.  
  53. if (isNaN(current) == true) {
  54. document.getElementsByTagName("footer")[0].setAttribute("style", styleEl+"-top:20px;");
  55. current = 0;
  56. } else {
  57. current = parseInt(current);
  58. }
  59.  
  60. if (current+offset > parseInt(getCSS("footer", "margin-top"))) {
  61. document.getElementsByTagName("footer")[0].setAttribute("style",styleEl+"-top:"+(current+offset)+"px;");
  62. }
  63. }
  64. }
  65.  
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement