我需要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);
- });
- });
我似乎无法滚动到所有工作.有人有什么想法吗?这是我导入的:
- <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>
解决方法
尝试这个
- $("#clickme").click(function() {
- $('html,body').animate({
- scrollTop: $("#wrap2").offset().top
- },2000);
- return false;
- });