scrollTo函数jQuery不工作

前端之家收集整理的这篇文章主要介绍了scrollTo函数jQuery不工作前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我需要Jquery的scrollTo功能来为这个网站工作: http://cinicraft.com/Silverman/index.html

我尝试了以下内容

  1. $(document).ready(function()
  2. {
  3. $("div.btnLp3").click(function(){
  4. $('body,html').scrollTo('#target-examples',800,{easing:'elasout'});
  5. });
  6. });

我也试过这个:

  1. $(document).ready(function()
  2. {
  3. $("div.btnLp3").click(function(){
  4. $('html,body').animate({ scrollTop: $(window.location.hash).offset().top},1000);
  5. });
  6. });

我似乎无法滚动到所有工作.有人有什么想法吗?这是我导入的:

  1. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"> </script>
  2. <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"> </script>

解决方法

尝试这个
  1. $("#clickme").click(function() {
  2. $('html,body').animate({
  3. scrollTop: $("#wrap2").offset().top
  4. },2000);
  5. return false;
  6. });

FIDDLE

猜你在找的jQuery相关文章