html - offset problems in jquery, works on chrome but not in firefox -
i'm using anchor navigation on website & fixed header. clicking on link of menu, page scrolls linked #. i've added js code calculate height of header , add height # link section not displayed under fixed header. works fine on chrome, not on firefox, don't understand doing wrong, can me ? here js code :
function scrolling(){ $('a[href^="#"]').bind('click.smoothscroll',function (e) { e.preventdefault(); var target = this.hash, $target = $(target); var offset = $('#header').outerheight(true); //alert(offset); $('html, body').stop().animate({ 'scrolltop': $target.offset().top-offset //--offset--// }, 1000, 'swing', function () { window.location.hash = target; }); }); }
and css :
#header{position: fixed;z-index: 1000;top: 0;padding-left:25px;padding-top: 20px;height: 75px;width:100%;min-width:590px}
thanks lot help
Comments
Post a Comment