我需要使jQuery的scrollTo函数在这个网站上工作:http://cinicraft.com/Silverman/index.html
我尝试了以下方法:
$(document).ready(function()
{
$("div.btnLp3").click(function(){
$('body,html').scrollTo('#target-examples', 800, {easing:'elasout'});
});
});
我也尝试过这个:
$(document).ready(function()
{
$("div.btnLp3").click(function(){
$('html, body').animate({ scrollTop: $(window.location.hash).offset().top}, 1000);
});
});
我似乎无法让 scrollTo
正常工作。有人有什么想法吗?这是我导入的代码:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"> </script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"> </script>
.offset().top - 20}
。 - user2898276