jQuery Splitter 分隔条插件

1.分隔条插件

有左右分隔,上下分隔,我这里介绍的是左右分隔。可以拖动这个分隔条,让左边或者右边的区域放大或缩小。


2.html文件:

<div id="splitter">
        <h2>Terms & Conditions</h2>
        <div class="pane" id="tocPane">
            <div class="inner">
                <ol>
                    <li><a href="#privacy">Your Privacy</a></li>
                    <li><a href="#celebs">Celeb's Privacy</a></li>
                    <li>Ownership & Intellectual Property
                        <ol style="list-style-type: lower-roman">
                            <li><a href="#liability">Liability</a></li>
                            <li><a href="#rights">Exclusive & Non-exclusive rights</a></li>
                            <li><a href="#ugc">User Generated Material</a></li>
                        </ol>
                    </li>
                </ol>
            </div>   
        </div>
        <div class="pane" id="contentPane">
            <div class="inner">
                <h3>User Generated Material</h3>
                <p>This website contains messaging systems and other user generated content toward the purpose and fulfillment of directory or indirectly contacting or stalking celebrities and/or their family and/or people in their vaguely related social sphere. Such content is here forth and eternally regarded as property of StarTrackr and parent company et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum</p>
            </div>
        </div>
      </div>

3.js文件片断:

$(document).ready(function(){
  $('#splitter > div:first').resizable({ 
    handles: 'e', 
    minWidth : '100',
    maxWidth : '400',
    resize: function() { 
      var remainingSpace = $(this).parent().width() - $(this).outerWidth();
      var divTwo = $(this).next();
      var divTwoWidth = remainingSpace - (divTwo.outerWidth() - divTwo.width());
      divTwo.css('width', divTwoWidth + 'px');
    }
  });
});

4.用到的css样式:

#splitter {
    height:150px;
    margin-top:30px;
    margin-bottom:50px;
}
#splitter .pane {
    width:50%;
    height:100%;
    float:left;
}

#splitter h2 { 
  margin-bottom:0; 
  padding-bottom:0;
}

#tocPane { 
    overflow: hidden;
    background:#d6dde5 url(handle.png) no-repeat right center;
}

#tocPane .inner { 
    width: 300px; 
}

#contentPane {
    overflow: auto;
}

#contentPane .inner {
    padding: 0 5px;
}

5.引入js类库:

  <script src="../../lib/jquery-1.7.1.min.js" type="text/javascript" charset="utf-8"></script>
  <script src="../../lib/jquery-ui-1.8.17.custom.min.js" type="text/javascript" charset="utf-8"></script>
  <script type="text/javascript" src="script.js"></script>


(完......)


  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值