首页 > 语言 > JavaScript > 正文

js 分栏效果实现代码

2024-05-06 14:14:14
字体:
来源:转载
供稿:网友
网上我也见到一些分栏效果,也有一个jquery的插件jquery.splitter.js, 但是他们基本都没有解决一个问题:如果页面上有iframe, 当拖动分割线经过iframe的时候,鼠标不听使唤了,我曾经开过帖子讨论过这个问题。本例采用一个小技巧解决了这个问题,使拖动流畅。
代码如下:
<html>
<head>
<title>Splitter demo</title>
<style>
            #splitter_container{
             width: 100%;
             height: 100%;
             border: solid #eee 1px;
             margin: 0px;
             padding: 0px;
             overflow: hidden;
            }
            #splitter_left_panel{
             width: 300px;
             height: 100%;
             float: left;
             border: solid blue 0px;
            }
            #splitter_bar{
             width: 8px;
             height: 100%;
             float: left;
             background-color: #ccc;
             cursor: col-resize;
            }
            #splitter_right_panel{
             height: 100%;
             padding-top: 10px;
            }
</style>
<script>
/*
* splitter.js
* author: sunxing007
* http://blog.csdn.net/sunxing007
* date: 08/26/2009

**************************************************************************************
The css script below is needed for the html page when using splitter.js, please save
it as splitter.css, and modify it carefully.
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选