jquery - Slow scroll for anchors -


i have found script anchors on page

$('.anchor').click(function (event) {   event.preventdefault();   var href = $(this).attr('href');   var target = $(href);   var top = target.offset().top;   $('html,body').animate({      scrolltop: top   }); }); 

but, when click on <div class="anchor">, page jumps position. possible slow scrolling?

you can this

$('html,body').animate({    scrolltop: top }, "slow"); 

.animate method looks this.

.animate( properties [, duration ] [, easing ] [, complete ] )

by default durations

slow - 600, normal - 400, fast - 200.

if not suitable case can give own duration


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -