jQuery实现浮动层跟随页面滚动效果
#main{height:2000px}
.demo{width:180px; height:250px; margin:10px; border:2px solid #ccc; background:#eee; padding:10px; }
#demo1{position:relative; margin-top:-290px;}
#demo2{position:absolute; margin-top:156px; right:10px;}
.demo a{text-decoration:underline; cursor:pointer}
.demo h3{font-size:14px}
.demo p{line-height:20px}
$(function(){
$("#demo1").scrollFollow({
offset: 156
});
$("#demo2").scrollFollow({
speed:1000,
//offset: 156,
//relativeTo:"bottom",
killSwitch: "switchlink",
onText: '取消滚动',
offText: '开启滚动'
});
});
Demo 1
滚动鼠标滚轮或者拖动浏览器的滚动条看看。
Demo 2
你可以通过点击下面的链接来开启和关闭浮动层的跟随滚动效果。
启动开关
helloweba
jQuery实现浮动层跟随页面滚动效果
Powered by 允许转载、修改和使用本站的DEMO,但请注明出处: