JS特效第141弹:jquery制作非常可爱的火箭筒返回顶部代码

         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>

        全部代码:jquery制作非常可爱的火箭筒返回顶部代码

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值