Jqurey实现类似EasyUI的页面布局可改变左右的宽度
2014-07-09 00:00
627 查看
截图如下:(可通过移动中间蓝色的条,来改变左右两边div的宽度)
具体实现代码如下:
具体实现代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default10.aspx.cs" Inherits="Default10" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> <script type="text/javascript" src="jQuery 2.0.3.js"></script> <style type="text/css"> .highlightTextSearch { background-color: Red; } a:hover { color: Red; } .style2 { width: 1000px; } .div { scrollbar-face-color: #DCDCDC; /* 游标的颜色 */ scrollbar-shadow-color: #99BBE8; /*游标边框的颜色*/ scrollbar-highlight-color: #FF3300; /*游标高亮*/ scrollbar-3dlight-color: #9EBFE8; scrollbar-darkshadow-color: #9EBFE8; scrollbar-track-color: #DFE8F6; /*滑动条背景颜色*/ scrollbar-arrow-color: #6699FF; /*箭头颜色*/ } </style> </head> <body> <form id="form1" runat="server"> <div> <table style="width: 1000px; height: auto" align="center" cellpadding="0" cellspacing="0"> <tr> <td style="width: 1000px; height: auto" align="center"> <table style="width: 1000px; height: auto"> <tr> <td style="width: 1000px; height: 670px; overflow: auto" align="left" valign="top"> <div style="overflow: auto; width: 325px; height: 500px; float: left; background-color: Yellow" id="movemodule" class="div"> </div> <div id="arrowborder" style="float: left; width: 5px; height: 500px; background-color: Blue; cursor: w-resize;"> </div> <div id="rightframe" style="width: 660px; height: 500px; float: left; overflow: auto; background-color: Aqua" class="div"> </div> </td> </tr> </table> </td> </tr> <tr> <td style="width: 1000px; height: 70px; background-image: url('Images/OAbottom.bmp')" align="center"> </td> </tr> </table> </div> <script type="text/javascript"> var isDown = false; var minwidth = 160; var maxwidth = 800; $("#arrowborder").mousedown(function () { this.setCapture(); isDown = true; $("body").css("cursor", "e-resize"); }); $("body").mouseup(function () { this.releaseCapture(); isDown = false; $("body").css("cursor", "default"); }); $("body").mousemove(function (event) { if (isDown) { var _mx = event.clientX; //var _my = event.clientY; var _poin = $("#arrowborder").offset(); var _w = _mx - _poin.left; var _lw = $("#movemodule").width(); var _rw = $("#rightframe").width(); if ((_lw + _w > minwidth && _w < 0) || (_lw + _w < maxwidth && _w > 0)) { $("#movemodule").width(_lw + _w); $("#rightframe").width(_rw - _w); } else { if (_w > 0) { $("#movemodule").width(maxwidth); $("#rightframe").width(_rw - (maxwidth - _lw)); } else { $("#movemodule").width(minwidth); $("#rightframe").width(_rw + (_lw - minwidth)); } } } }); </script> </form> </body> </html>
相关文章推荐
- Jqurey实现类似EasyUI的页面布局可改变左右的宽度
- Jqurey实现类似EasyUI的页面布局
- 左右两栏布局右侧自适应+左右拖动改变两栏宽度
- js 实现table每列可左右拖动改变列宽度
- 用UWP实现一个和win10设置页面类似的布局
- easyui最简单的左右布局实现,及tab的右键菜单实现
- 利用Overflow:Hidden实现自适应左右两列布局/填充父级元素剩余宽度
- jquery-easyui实现页面布局和增删改查操作(SSH2框架支持)
- 可拖动拉伸的左右分栏效果,本例子是用Table以及JS来实现的,左右分栏可改变,拖动中间的边框就可实现宽度的调整,点击时可设置为隐藏左侧列表。
- jquery-easyui实现页面布局和增删改查操作(SSH2框架支持)
- 三栏自适应布局实现(左右固定宽度,中间自适应)
- 页面头部和左侧固定并撑满,只有右侧部分内容改变的布局实现
- 用UWP实现一个和win10设置页面类似的布局
- css实现左右布局,左侧div固定不变,右侧div宽度自适应
- [转] js 实现table每列可左右拖动改变列宽度
- CSS实现左右栏宽度固定中间栏宽度变化且各栏高度自适应背景色不同的三栏布局
- jquery-easyui实现页面布局和增删改查操作(SSH2框架支持)
- jquery-easyui实现页面布局和增删改查操作(SSH2框架支持)转载
- css布局小技巧---1:有一侧宽度固定,另一侧随浏览器及分辨率改变而改变的css页面布局
- 前端经典面试题之CSS实现三栏布局,左右宽度固定,中间宽度自适应