html - jquery scrollTop offset issue -


i trying build anchor link allows panel 2 slide cover panel 1, leave black header visible:

http://jsfiddle.net/xmpu4/19/

i'm setting offset with:

'scrolltop': $target.offset().top - 140 

it milisecond , jump top of page.

how can set stops in right place?

it works have written:

$('html, body').stop().animate({     'scrolltop': $target.offset().top - 140 }, 600, 'swing', function () {     window.location.hash = target; }); 

the first part animates scrolling, , when finished, tell window jump specific hash.

notice happens when click function has this:

window.location.hash = target; 

remove callback function , prevent page jumping hash.


on unrelated note, suggest don't use hard-coded values in animation function. try instead:

'scrolltop': $target.offset().top - $("#a").offset().top; 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -