jquery實(shí)現(xiàn)類似EasyUI的頁面布局可改變左右的寬度
更新時間:2020年09月12日 14:27:56 投稿:whsnow
這篇文章主要介紹了通過jquery實(shí)現(xiàn)類似EasyUI的頁面布局可改變左右的寬度,需要的朋友可以參考下
截圖如下:(可通過移動中間藍(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; /*滑動條背景顏色*/
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)前頁面高度和寬度的兩個函數(shù)
- 用js來定義瀏覽器中一個左右浮動元素相對于頁面主體寬度的位置的函數(shù)
- js獲得頁面的高度和寬度的方法
- js 獲取頁面高度和寬度兼容 ie firefox chrome等
- jquery實(shí)現(xiàn)在頁面加載完畢后獲取圖片高度或?qū)挾?/a>
- js獲取input長度并根據(jù)頁面寬度設(shè)置其大小及居中對齊
- 手機(jī)端頁面rem寬度自適應(yīng)腳本
- jQuery獲取頁面及個元素高度、寬度的總結(jié)——超實(shí)用
- 手機(jī)屏幕尺寸測試——手機(jī)的實(shí)際顯示頁面的寬度
相關(guān)文章
jquery統(tǒng)計輸入文字的個數(shù)并對其進(jìn)行判斷
判斷輸入文字個數(shù)并提示還可以輸入多少個字,類似的功能使用jquery便可輕松實(shí)現(xiàn)2014-01-01
jquery創(chuàng)建一個ajax關(guān)鍵詞數(shù)據(jù)搜索實(shí)現(xiàn)思路
我們經(jīng)常需要在前臺頁面輸入關(guān)鍵詞進(jìn)行數(shù)據(jù)的搜索這已經(jīng)成為了一種習(xí)慣今天給大家分享一下如何使用 jQuery,MySQL和Ajax創(chuàng)建簡單和有吸引力的Ajax搜索,感興趣的你可不要錯過了哈2013-02-02
利用JQuery操作iframe父頁面、子頁面的元素和方法匯總
這篇文章主要給大家介紹了關(guān)于利用JQuery操作iframe父頁面、子頁面的元素和方法的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧。2017-09-09
jquery實(shí)現(xiàn)圖片跟隨鼠標(biāo)的實(shí)例
這篇文章主要介紹了 jquery實(shí)現(xiàn)圖片跟隨鼠標(biāo)的實(shí)例的相關(guān)資料,希望通過本文能幫助到大家實(shí)現(xiàn)這樣的功能,需要的朋友可以參考下2017-10-10

