Rails 4 and Foundation 5 - Sticky Footer? -
so using static pages until decided migrate on rails use in web app.
i able create sticky footer following codepen:
http://codepen.io/aetles/pen/jadzw
$(function(){ $(document).foundation(); }); window.onload = function() { stickyfooter(); }; function checkfordomchange() { stickyfooter(); } //check resize event if not ie 9 or greater window.onresize = function() { stickyfooter(); } //lets margintop <footer> function getcss(element, property) { var elem = document.getelementsbytagname(element)[0]; var css = null; if (elem.currentstyle) { css = elem.currentstyle[property]; } else if (window.getcomputedstyle) { css = document.defaultview.getcomputedstyle(elem, null). getpropertyvalue(property); } return css; } function stickyfooter() { console.log("sticky footer firing"); if (document.getelementsbytagname("footer")[0].getattribute("style") != null) { document.getelementsbytagname("footer")[0].removeattribute("style"); } if (window.innerheight != document.body.offsetheight) { var offset = window.innerheight - document.body.offsetheight; var current = getcss("footer", "margin-top"); if (isnan(current) == true) { document.getelementsbytagname("footer")[0].setattribute("style","margin-top:0px;"); current = 0; } else { current = parseint(current); } if (current+offset > parseint(getcss("footer", "margin-top"))) { document.getelementsbytagname("footer")[0].setattribute("style","margin-top:"+(current+offset)+"px;"); } } }
however, when deploy real-time application utilizing rails, event getting fired (i tested console.log messages) doesn't edit position of footer.
(view console in following page) https://still-plains-7660.herokuapp.com/
because i'm using partial footer itself, rails doesn't know move? source code on rendered page looks should.
is there more elegant gem or solution can utilize have sticky footer not have fixed height? (i need responsive).
considering works fine on static page, i'm sure there can tweak can't seem figure out why won't stick in rails deployment.
i cannot remember did when created sticky footer using foundation. think found solution you.
Comments
Post a Comment