码迷,mamicode.com
首页 > 其他好文 > 详细

滚动侦测scrollspy

时间:2015-08-26 10:39:47      阅读:349      评论:0      收藏:0      [点我收藏+]

标签:

<!doctype html>
<html>

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Amaze UI Examples</title>
<link rel="stylesheet" href="assets/css/amazeui.min.css">
<!-- <link rel="stylesheet" href="assets/css/app.css">-->
</head>

<body>
<div style="height: 800px;"></div>
<div class="am-panel am-panel-primary" id="my-scrollspy">
<div class="am-panel-hd">ScrollSpy via JS
</div>
<div class="am-panel-bd">
生命是一团欲望,欲望不满足便痛苦,满足便无聊。人生就在痛苦和无聊之间摇摆。——叔本华
</div>
</div>
<div class="am-panel am-panel-primary" id="my-scrollspy2">
<div class="am-panel-hd">ScrollSpy via JS
</div>
<div class="am-panel-bd">
生命是一团欲望,欲望不满足便痛苦,满足便无聊。人生就在痛苦和无聊之间摇摆。——叔本华
</div>
</div>

<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="assets/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->

<!--[if (gte IE 9)|!(IE)]><!-->
<script src="assets/js/jquery.min.js"></script>
<!--<![endif]-->
<script src="assets/js/amazeui.min.js"></script>
<script>
$(function() {
$(‘#my-scrollspy‘).on(‘inview.scrollspy.amui‘, function() {
console.log(‘进入视口‘);
}).on(‘outview.scrollspy.amui‘, function() {
console.log(‘离开视口‘);
});
//eg
$(‘#my-scrollspy‘).scrollspy({
animation: ‘slide-left‘,
delay: 500
})
$(‘#my-scrollspy2‘).scrollspy({
animation: ‘fade‘,
delay: 1000
})
});
</script>
</body>

</html>

滚动侦测scrollspy

标签:

原文地址:http://www.cnblogs.com/zhouyx/p/4759607.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!