赞
踩
jquery星空火箭置顶,网页返回页面顶部,有动画效果,先来看看效果:
一部分关键的代码如下:
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>超可爱的星空火箭置顶jquery特效</title>
-
- <style type="text/css">
- body{background:url(images/blog7year_videobg.png);}
-
- /* actGotop */
- .actGotop{position:fixed;top:0;margin:480px 0 0 0;right:50px;width:150px;height:195px;display:none;}
- *html .actGotop{position:absolute;top:expression(eval(document.documentElement.scrollTop));}
- .actGotop a,.actGotop a:link{width:150px;height:195px;display:inline-block;background:url(images/blog7year_gotop.png) no-repeat;_background:url(images/blog7year_gotop.gif) no-repeat;outline:none;}
- .actGotop a:hover{width:150px;height:195px;background:url(images/blog7year_gotopd.gif) no-repeat;outline:none;}
- </style>
-
- </head>
-
- <body style="height:3000px;">
-
-
- <div class="actGotop"><a href="javascript:;" title="Top"></a></div>
-
- <script type="text/javascript" src="js/jquery.min.js"></script>
- <script type="text/javascript">
- $(function(){
- $(window).scroll(function() {
- if($(window).scrollTop() >= 100){
- $('.actGotop').fadeIn(300);
- }else{
- $('.actGotop').fadeOut(300);
- }
- });
- $('.actGotop').click(function(){$('html,body').animate({scrollTop: '0px'}, 800);});
- });
- </script>
-
- </body>
- </html>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。