jquery實(shí)現(xiàn)類似EasyUI的頁面布局可改變左右的寬度
截圖如下:(可通過移動(dòng)中間藍(lán)色的條,來改變左右兩邊div的寬度)
具體實(shí)現(xiàn)代碼如下:
<%@ 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; /* 游標(biāo)的顏色 */ scrollbar-shadow-color: #99BBE8; /*游標(biāo)邊框的顏色*/ scrollbar-highlight-color: #FF3300; /*游標(biāo)高亮*/ scrollbar-3dlight-color: #9EBFE8; scrollbar-darkshadow-color: #9EBFE8; scrollbar-track-color: #DFE8F6; /*滑動(dòng)條背景顏色*/ 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>
- 準(zhǔn)確獲得頁面、窗口高度及寬度的JS
- jquery 得到當(dāng)前頁面高度和寬度的兩個(gè)函數(shù)
- 用js來定義瀏覽器中一個(gè)左右浮動(dòng)元素相對(duì)于頁面主體寬度的位置的函數(shù)
- js獲得頁面的高度和寬度的方法
- js 獲取頁面高度和寬度兼容 ie firefox chrome等
- jquery實(shí)現(xiàn)在頁面加載完畢后獲取圖片高度或?qū)挾?/a>
- js獲取input長(zhǎng)度并根據(jù)頁面寬度設(shè)置其大小及居中對(duì)齊
- 手機(jī)端頁面rem寬度自適應(yīng)腳本
- jQuery獲取頁面及個(gè)元素高度、寬度的總結(jié)——超實(shí)用
- 手機(jī)屏幕尺寸測(cè)試——手機(jī)的實(shí)際顯示頁面的寬度
相關(guān)文章
jQuery EasyUI API 中文文檔 - Dialog對(duì)話框
jQuery EasyUI API 中文文檔 - Dialog對(duì)話框使用說明,需要的朋友可以參考下。2011-11-11基于JavaScript如何實(shí)現(xiàn)ajax調(diào)用后臺(tái)定義的方法
由于ajax的獨(dú)特優(yōu)勢(shì),使得它在當(dāng)前大量網(wǎng)站得到了廣泛的應(yīng)用,下面就介紹一下ajax如何調(diào)用后臺(tái)定義的函數(shù),對(duì)ajax調(diào)用后臺(tái)方法相關(guān)知識(shí)感興趣的朋友一起學(xué)習(xí)吧2015-12-12jquery實(shí)現(xiàn)點(diǎn)擊label的同時(shí)觸發(fā)文本框點(diǎn)擊事件的方法
這篇文章主要介紹了jquery實(shí)現(xiàn)點(diǎn)擊label的同時(shí)觸發(fā)文本框點(diǎn)擊事件的方法,涉及jQuery鼠標(biāo)事件及頁面元素操作的技巧,需要的朋友可以參考下2015-06-06jQuery右側(cè)選項(xiàng)卡焦點(diǎn)圖片輪播特效代碼分享
這篇文章主要介紹了jQuery右側(cè)選項(xiàng)卡焦點(diǎn)圖片輪播特效,一段清新可愛的焦點(diǎn)圖輪播代碼,有需要的小伙伴可以參考下2015-09-09jquery 圓角遮罩圖片實(shí)現(xiàn)圖片圓角
用jquery實(shí)現(xiàn)的圖片圓角效果代碼。2009-05-05ajax 文件上傳應(yīng)用簡(jiǎn)單實(shí)現(xiàn)
今天看到一個(gè)jquery插件jquery.fileupload.v.1.5.0,自己試著結(jié)合java做了一個(gè)ajax的文件上傳小應(yīng)用2009-03-03