Sunday, 15 May 2011

uikit - jQuery scrolltop - not working after first use -



uikit - jQuery scrolltop - not working after first use -

i using jquery scrolltop function on menu: http://goethesternfriseure.de/index.php

the issue scroll function working @ first time. after sec click on link, scrolls much bottom.

$('.sectionlink').click(function(e){ var sectionelement = $(this).attr("rel"); var myoffset = $('#'+sectionelement).offset().top; $('html, body').animate({ scrolltop: myoffset }, 800); e.preventdefault(); });

does know whats happening there?

your scroll top not functioning cause have add together "px" :

$('.sectionlink').click(function(e){ var sectionelement = $(this).attr("rel"); var myoffset = $('#'+sectionelement).offset().top; $('html, body').animate({ scrolltop: myoffset+"px" }, 800); e.preventdefault(); });

jquery uikit scrolltop

No comments:

Post a Comment