jQuery滚动页面div悬浮不动插件jquery.pinBox

jQuery滚动页面div悬浮不动插件jquery.pinBox3097
使用jquery.pinBox插件需要在页面中引入jquery1.7+和jquery.pinBox.min.js文件。
<script src="jquery-1.9.1.min.js"></script>
<script src="js/jquery.pinBox.min.js"></script>    
只需要将你需要滚动固定的元素放置在一个容器中,例如下面的代码中的#pinBoxContainer,通过为固定元素添加一个class,例如.pinBox。
<div class="container" id="pinBoxContainer">
<!--如果你不使用bootstrap.css,并且div的父元素是浮动(float)的,就要确保为其添加一个[position:relative]属性-->
    <div class="col-sm-4">
    <!-- box you want to pin inside [id="pinBoxContainer"] have class or id -->
        <div class="pinBox">
            <h2 class="headColor">Example box</h2>
            <p>some text</p>
        </div>
    </div>
 
    <div class="col-sm-8">
        <h2 class="headColor">Example box</h2>
        <p>some text</p>
    </div>
</div>    
通过下面的方法来初始化该插件。
 $(".pinBox").pinBox({
        Top : '50px',
        Container : '#pinBoxContainer',
    });
Top:元素固定时距离容器顶部的距离,默认为0。
Container:容器的jQuery选择器,默认值为.container。
ZIndex:元素的z-index属性,默认值为20。
MinWidth:视口的最小宽度,当小于这个宽度时元素不再固定。默认值为767像素。
Events:回调事件。

也许你还喜欢