淘宝首页返回顶部效果怎么做到的?
重写window.onscroll()事件,先将返回顶部div设置为position:fixed;right:10px;bottom:10px;display:none,一旦event.scrollTop>100(100可以设置为你想要的值)就display:block(fadeIn()),否则display:none(fadeOut())。还要设置返回顶部div点击事件,onclick(function(){$('body,html').animate({scrollTop:0},1000);}),这个什么意思不用我多说吧,既然搞Jquery,动画还是应该晓得。
<style type="css/text"> #gotop{position:fixed;right:10px;bottom:10px;display:none}</style><div id="gotop"></div><script type="javascript/text"> $(function(){ $(window).scroll(function(){ if($(window).scrollTop > 100){ $("#gotop").fadeIn(1000);//一秒渐入动画 }else{ $("#gotop").fadeOut(1000);//一秒渐隐动画 } }); $("#gotop").click(function(){ $('body,html').animate({scrollTop:0},1000); }); });</script>jquery打开页面window.location和window.open的区别?
window.location = "http://www.xxxxxxxx.net" 跳转后有后退功能
其实应该是 window.location.href
window.location.replace("http://www.xxxxxxxx.net") 跳转后没有后退功能
window.open("http://www.xxxxxxxx.net") 要新的窗口打开链接
这个一般用于简单的弹出页面,现在基本上都被屏蔽掉了window.location.reload();window.location = "/Admin/UserList";window.open("/Admin/UserList");
window.location.href = '/Admin/UserList';
window.location.reload()刷新当前页面.
parent.location.reload()刷新父亲对象(用于框架)
opener.location.reload()刷新父窗口对象(用于单开窗口)
top.location.reload()刷新最顶端对象(用于多开窗口)
都是重定向

