I have this jquery code to scroll to an element when another is clicked
$("#element1").click(function() {
$('html, body').animate({ scrollTop: $("#element2").offset().top }, 1000);
});
Now i need to implement an easeInOutCirc easing on this movement, using the Jquery Easing Plugin http://gsgd.co.uk/sandbox/jquery/easing/
Never seem to get it right, please help
答案 0 :(得分:1)
$(".scroll-top").on("click", function(e){
e.preventDefault();
$("html, body").animate({scrollTop:"0"},900,"easeInSine");
});
答案 1 :(得分:0)
Like it said in the documentation, you have to do :
$("#element1").click(function(e) {
$('html, body').animate({
scrollTop: $("#element2").offset().top
},
{
duration: 1000,
easing: easeInOutCirc
});
});