javascript - Banner position off upon window resize with sticky nav -


i've encountered issue sticky nav/banner image duo i'm trying implement. check out here: http://lucid-build.com/stack/sticky/ issue is, when resize window, position of banner off. otherwise, acts it's supposed to. suggestions on how fix appreciated!

[edit] here's script!

function resizebanner() {     var bannerh = $(".banner img").height();     $(".banner").css("height", bannerh); }  function fixednav() {     var logot = $(".logo").offset().top;     var bannerh = $(".banner img").height();      $(window).scroll(function() {         if($(window).scrolltop() > logot ) {             $("#header").addclass("fixed").css(("height"),120);             $(".banner").css(("margin-top"),-bannerh+120);             $("body").css(("margin-top"),bannerh+18);                } else {             $("#header").removeclass("fixed").css(("height"),("auto"));             $(".banner").css(("margin-top"),0);             $("body").css(("margin-top"),0);         }     }); }   $(window).resize(function() {     resizebanner(); });  $(window).load(function() {     resizebanner();     fixednav(); });  $(document).ready(function() {     resizebanner(); }); 

you have add element's css has class "banner" :

position : absolute; bottom : 0; 

ps : box resizing right set in top left default of header set. parent box set on position : relative, absolute element in refer parent , not full document.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -