Portamento是一个jQuery插件,用于为网页添加一个浮动面板。当网页滚动时,面板也会随着滚动。
使用是很容易的。只是按照下面的步骤,你会有一个平稳的滑动面板 !
1.在您的页面,只是之前</body>中加入 portamento.js和jquery库.
1 2 | <script src="portamento.js"></script><script src="jquery-1.9.1.min.js"></script> |
2.在您的 html中加入您想要浮动的div定义好id如"#sidebar".
1 2 3 | <div id="sidebar"><p>Hello, I'm a sliding panel - unless the viewport </p></div> |
3.在您的 JavaScript 应用插件到你想要元素中:
1 2 3 | <script>$('#sidebar').portamento({disableWorkaround: true}); </script> |
4.css中加入样式
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #wrapper { overflow:hidden;}#content { width:486px; margin-right:10px; float:left; min-height:1200px;}#sidebar { width:284px; padding:10px; background:#eee; float:right; height:400px;}#portamento_container { float:right; position:relative;}#portamento_container #sidebar { float:none; position:absolute;}#portamento_container #sidebar.fixed { position:fixed;} |
特别申明:
本站所有资源都是由网友投稿发布,或转载各大下载站,请自行检测软件的完整性!
本站所有资源仅供学习与参考,请勿用于商业用途,否则产生的一切后果将由您自己承担!
如有侵权请联系我们删除下架,联系方式:lei1294551502@163.com