滚动到底部案例

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
			*{
				padding: 0px;
				margin: 0px;
			}
			.wrap{
				width: 900px;
				margin-left: 50px;
			}
			.box{
				width: 900px;
				height: 300px;
				border: 1px solid darkblue;
				margin-bottom: 100px;
				background: red;
				color: rosybrown;
				font-size: 14px;
			}
			#bottom{
				margin-bottom: 0px;
			}
			.right{
				width: 90px;
				height: 235px;
				border: 1px solid rosybrown;
				position: fixed;
				top: 0px;
				right: 30px;
				bottom: 120px;
				text-align: center;
				padding-bottom: 5px;
			}
			.right p{
				cursor: pointer;
				margin-bottom:20px ;
			}
			.right p:hover{
				font-size: large;
			}
			.goto{
				position: fixed;
				bottom: 120px;
				right: 30px;
			}
			.top,.bottom{
				display: block;
				width: 70px;
				height: 50px;
				border-radius: 50%;
				margin-top: 15px;
				cursor: pointer;
			}
		</style>
		<script type="text/javascript" src="jquery-1.7.1.min.js" ></script>
		<script type="text/javascript">
			$(function(){
				$('.top').click(function(){
					$('html').animate({'scrollTop':'0'},900)
				})
				$('.bottom').click(function(){
					$('html').animate({'scrollTop':$('#bottom').offset().top},900)
				})
				$('.right p').click(function(){
					var index=$(this).index();
					$('html').animate({'scrollTop':$('div').eq(index+1).offset().top},900)
				})
			})
		</script>
	</head>
	<body>
		<div class="wrap">
			<div class="box">
				<h1>第一部分</h1>
				<p>第一部分内容如下:花费巨额看来看如果卡价格哪里看人噶看到卡人解放碑马卡洛夫你不可能比人能看房可能 </p>
			</div>
			<div class="box">
				<h1>第二部分</h1>
				<p>第二部分内容如下:你给看看了解该肉价格拉人家化工为阿尔能啊 经阿卡丽归纳激昂骄傲</p>
			</div>
			<div class="box">
				<h1>第三部分</h1>
				<p>第三部分内容如下:合法进入韩国为啊UR改回去二哈哈几个哈健康啊结果哈就但是该和你发给JKEWHGUIHSGAJB反对比姐姐好诶人的那就客人贵哦</p>
			</div>
			<div class="box">
				<h1>第四部分</h1>
				<p>第四部分内容如下:合法进入韩国为啊UR改回去二哈哈几个哈健康啊结果哈就但是该和你发给JKEWHGUIHSGAJB反对比姐姐好诶人的那就客人贵哦</p>
			</div>
			<div class="box">
				<h1>第五部分</h1>
				<p>第五部分内容如下:合法进入韩国为啊UR改回去二哈哈几个哈健康啊结果哈就但是该和你发给JKEWHGUIHSGAJB反对比姐姐好诶人的那就客人贵哦</p>
			</div>
			<div class="box" id="bottom">
				<h1>第六部分</h1>
				<p>第六部分内容如下:合法进入韩国为啊UR改回去二哈哈几个哈健康啊结果哈就但是该和你发给JKEWHGUIHSGAJB反对比姐姐好诶人的那就客人贵哦</p>
			</div>
		</div>
		<div class="right">
			<p>第一部分</p>
			<p>第二部分</p>
			<p>第三部分</p>
			<p>第四部分</p>
			<p>第五部分</p>
			<p>第六部分</p>
		</div>
		<div class="goto">
			<input type="button" value="回到顶部" class="top" />
			<input type="button" value="回到底部" class="bottom" />
		</div>
	</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值