javascript DIV浮动插件介绍
本文章简单的介绍了关于javascript DIV浮动插件,有需要用的朋友可以参考一下。如下: 代码如下 div id=wrapper div id=content pThis shows a sliding panel with no bottom boundary, and a bigger gap between the to
本文章简单的介绍了关于javascript DIV浮动插件,有需要用的朋友可以参考一下。如下:
2.?置 CSS
代?如下:
3.引用portamento.js
portamento.js代?如下:
4.在js中?用
代码如下 | |
<div id="wrapper"> |
代码如下 | |
<style type="text/css"> #wrapper {overflow: hidden; width:100%; } #content {width:70%; margin-right:10px; float:left; min-height:1200px;} #sidebar {width:200px; padding:10px; background:#f05b72 ; float:right; height:400px; } #portamento_container {float:right; position:relative;} /* take the positioning of the sidebar, and become the start point for the sidebar positioning */ #portamento_container #sidebar {float:none; position:absolute;} /* no need to float anymore, become absolutely positoned */ #portamento_container #sidebar.fixed {position:fixed;} /* if the panel is sliding, it needs position:fixed */ </style> |
代码如下 | |
/*! |
代码如下 | |
<script type="text/javascript"> $('#sidebar').portamento({ gap: 100 }); // set a 100px gap rather than the default 10px </script> |
精彩图集
精彩文章