jQuery左右伸缩菜单框架

前端之家收集整理的这篇文章主要介绍了jQuery左右伸缩菜单框架前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

下面是编程之家 jb51.cc 通过网络收集整理的代码片段。

编程之家小编现在分享给大家,也给大家做个参考。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><head><Meta http-equiv="Content-Type" content="text/html; charset=UTF-8">


<title>无标题文档</title>
<style type="text/css"> 
html,body {
	height:100%;
	margin:0px;
	padding:0px;
	background-color:#EFEFEF;
	font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;
	font-size:12px;
	line-height:1.5;
	color:#333;
}

.leftBox1{  width: 120px; background-color:#F5F5F5; border:1px solid #DDDDDD;}
.leftBox2{   width: 30px; background-color:#F5F5F5; border:1px solid #DDDDDD;animation: myfirst2 0.3s; -moz-animation: myfirst2 0.3s; -webkit-animation: myfirst2 0.3s;}
.leftBox2:hover{ width: 120px; background-color:#F5F5F5; border:1px solid #DDDDDD; Box-shadow:1px 1px 5px 1px rgba(0,0.2); animation: myfirst 0.3s; -moz-animation: myfirst 0.3s; -webkit-animation: myfirst 0.3s;}
.leftBox2 ul{ display:none;}
.leftBox2:hover ul{display:block;}

.rightBox1{  width: 120px; background-color:#F5F5F5; border:1px solid #DDDDDD;}
.rightBox2{   width: 30px; background-color:#F5F5F5; border:1px solid #DDDDDD;animation: myfirst2 0.3s; -moz-animation: myfirst2 0.3s; -webkit-animation: myfirst2 0.3s;}
.rightBox2:hover{ width: 120px; background-color:#F5F5F5; border:1px solid #DDDDDD; Box-shadow:1px 1px 5px 1px rgba(0,0.2); animation: myfirst 0.3s; -moz-animation: myfirst 0.3s; -webkit-animation: myfirst 0.3s;}
.rightBox2 ul{ display:none;}
.rightBox2:hover ul{display:block;}

.rightBox3{   width: 30px; background-color:#F5F5F5; border:1px solid #DDDDDD;}
.rightBox3 ul{ display:none;}
/*.rightBox3:hover ul{display:block;}*/

@keyframes myfirst
{
0%   {width:30px;}
100% {width:120px;}
}

@-moz-keyframes myfirst /* Firefox */
{
0%   {width:30px;}
100% {width:120px;}
}

@-webkit-keyframes myfirst /* Safari 和 Chrome */
{
0%   {width:30px;}
100% {width:120px;}
}

@keyframes myfirst2
{
0%   {width:100px;}/*如果按照Div的宽带来填,即会出现不友好的用户体验*/
100% {width:30px;}
}

@-moz-keyframes myfirst2 /* Firefox */
{
0%   {width:100px;}/*如果按照Div的宽带来填,即会出现不友好的用户体验*/
100% {width:30px;}
}

@-webkit-keyframes myfirst2 /* Safari 和 Chrome */
{
0%   {width:100px;}/*如果按照Div的宽带来填,即会出现不友好的用户体验*/
100% {width:30px;}
}


.clearfloat{ clear:both;}

#mainContent{ overflow:auto; margin:20px 142px 20px 142px;}
#leftBox{margin-right:20px; position:fixed; left:0; top:0; height:100%;}
#rightBox{margin-left:20px; position:fixed; right:0; top:0; height:100%;}
#leftBoxa{right:0px; text-align:right; margin: 4px;}
#rightBoxa{left:0px; text-align:left; margin: 4px;}
#righta{margin-right: 4px;}

</style>
</head>

<body>

    <div id="leftBox" class="leftBox1">
        <div id="leftBoxa"><img id="lefta" src="frame/left.png" onclick="closeBoxleft(1);"></div>
            <ul>
                <li>1</li>
                <li>2</li>
                <li>3</li>
                <li>4</li>
                <li>5</li>
            </ul>
    </div>

    <div id="rightBox" class="rightBox1">
        <div id="rightBoxa"><img id="righta" src="frame/right.png" onclick="closeBoxright(1);"><img id="righta" src="frame/lock.png" onclick="closeBoxrightlock(1);"></div>
            <ul>
                <li>1</li>
                <li>2</li>
                <li>3</li>
                <li>4</li>
                <li>5</li>
            </ul>
    </div>

  		<div style="margin-right: 142px;" id="mainContent">
            Quisque ornare risus quis  ligula. Phasellus trsce  varius 
urna id quam. Sed neque mi,varius eget,tincidunt nec,suscipit id,libero.
            Quisque ornare risus quis  ligula. Phasellus trsce  varius 
urna id quam. Sed neque mi,libero.
            v
            Quisque ornare risus quis  ligula. Phasellus trsce  varius 
urna id quam. Sed neque mi,libero. 
            Quisque ornare risus quis  ligula. Phasellus trsce  varius 
urna id quam. Sed neque mi,libero.
		</div>
		
		<div class="clearfloat"></div>




<script src="//code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
<script>
function closeBoxleft(v){
	if(v == 1){
		$("#leftBox").removeClass("leftBox1");
		$('#leftBox').addClass('leftBox2');
		$("#leftBoxa").html("<img id='lefta' src='frame/right.png' onclick='closeBoxleft(2);'/>");
        $("#mainContent").css("margin-left","50px")
	}else{
		$("#leftBox").removeClass("leftBox2");
		$("#leftBox").addClass("leftBox1");
		$("#leftBoxa").html("<img id='lefta' src='frame/left.png' onclick='closeBoxleft(1);'/>");
        $("#mainContent").css("margin-left","142px")
	}
}
function closeBoxright(v){
    if(v == 1){
        $("#rightBox").removeClass("rightBox1");
        $('#rightBox').addClass('rightBox2');
        $("#rightBoxa").html("<img id='righta' src='frame/left.png' onclick='closeBoxright(2);'/>");
        $("#mainContent").css("margin-right","50px")
    }else{
        $("#rightBox").removeClass("rightBox2");
        $("#rightBox").addClass("rightBox1");
        $("#rightBoxa").html("<img id='righta' src='frame/right.png' onclick='closeBoxright(1);'/><img id='righta' src='frame/lock.png' onclick='closeBoxrightlock(1);'/>");
        $("#mainContent").css("margin-right","142px")
    }
}
function closeBoxrightlock(v){
    if(v == 1){
        $("#rightBox").removeClass("rightBox1");
        $('#rightBox').addClass('rightBox3');
        $("#rightBoxa").html("<img id='righta' src='frame/lock_unlock.png' onclick='closeBoxrightlock(2);'/>");
        $("#mainContent").css("margin-right","50px")
    }else{
        $("#rightBox").removeClass("rightBox3");
        $("#rightBox").addClass("rightBox1");
        $("#rightBoxa").html("<img id='righta' src='frame/right.png' onclick='closeBoxright(1);'/><img id='righta' src='frame/lock.png' onclick='closeBoxrightlock(1);'/>");
        $("#mainContent").css("margin-right","142px")
    }
}
</script>
</body></html>

以上是编程之家(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。

如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。

原文链接:https://www.f2er.com/html/457427.html

猜你在找的HTML相关文章