首页 > 代码库 > jQuery实现收缩展开左边栏
jQuery实现收缩展开左边栏
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Index.aspx.cs" Inherits="Frame_Index" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<link href="http://www.mamicode.com/css/Style.css" rel="stylesheet" />
<script src="http://www.mamicode.com/js/jquery-2.1.0.js"></script>
<script>
$(document).ready(function () {
$("#to_left").click(function () {
if ($(this).attr("src") == "../imgs/to_left.png") {
$("div.nt_main").addClass("nt_main_no");
$(this).attr("src", "../imgs/to_right.png");
$("div.mb_main").css("margin-left", "7px");
} else {
$("div.nt_main").removeClass("nt_main_no");
$(this).attr("src", "../imgs/to_left.png");
$("div.mb_main").css("margin-left", "214px");
}
});
});
</script>
</head>
<body style=" background-color:#ededed;">
<form id="form1" runat="server">
<!--顶部菜单-->
<div class="tm_top">
<div class="welc">
<asp:Label ID="lbl_welc" runat="server"></asp:Label>
</div>
<div class="quit">
<asp:HyperLink ID="hpl_quit" runat="server" NavigateUrl="~/Login.aspx" Target="_parent" ToolTip="安全退出">安全退出</asp:HyperLink>
</div>
<div class="clr"></div>
</div>
<!--左边导航-->
<div class="nt_main">
</div>
<!--中间收缩-->
<div class="mid_img">
<img id="to_left" src="http://www.mamicode.com/imgs/to_left.png" alt="收缩" />
</div>
<!--右边主体-->
<div class="mb_main">
</div>
<div class="clrs"></div>
</form>
</body>
</html>