1000字范文,内容丰富有趣,学习的好帮手!
1000字范文 > html右侧浮动栏随着滚动 jQuery实现div浮动层跟随页面滚动效果

html右侧浮动栏随着滚动 jQuery实现div浮动层跟随页面滚动效果

时间:2020-10-29 19:12:47

相关推荐

html右侧浮动栏随着滚动 jQuery实现div浮动层跟随页面滚动效果

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,但请注明出处:

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。