我的目的是要让点击右下角的那个蓝色的方块,然后跳到顶部的导航横栏那为什么没用啊<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>ad</title> <style type="text/css"> *{margin: 0; padding: 0;} div{background: red; width: 100%; height: 3000px;} div#list{height: 100px; width: 100%; background: green; position: fixed;} div#go{height: 100px; width: 100px; background: blue; position: fixed; bottom: 10px; right: 10px;} </style> <script type="text/javascript" src="http://www.keleyi.com/keleyi/pmedia/jquery-1.9.1.min.js"></script> <script type="text/javascript"> $(function () { $(window).scroll(function () { if ($(window).scrollTop() > 200) { $("#list").slideUp(1000); } else { $("#list").slideDown(1000); } }); $("#go").click(function(){ $(“html,body”).animate({scrollTop:$(“#list”).offset().top},1000); }); }); </script></head><body> <div> <div id="list"></div> <div id="go"></div> </div></body></html>
添加回答
举报
0/150
提交
取消