使用Jquery和CSS折叠图像
Javascript 代码 包含javascipt和HTML代码。高防服务器图像 $(“。使用imagebox”)。折叠mouseover(function(){ })。图像mouseout(function { }) - imagebox是使用div标签的类名。 $(“。折叠showlink”)。云服务器图像click(function(){ }) - .showlink是使用show anchor tag的类名。 $(“。折叠hidelink”)。图像click(function(){ }) - .hidelink是隐藏锚标记的类名。香港云服务器 使用Jquery CSS函数chaning max-height:100px
<script type=" text/javascript " src=" http://ajax.googleapis.com/ ajax/libs/jquery/1.4.2/jquery.min.js " > </script> <script type=" text/javascript " > $(document).ready( function()
{
// Image Area Mouseover and Mouseout
$(".imagebox"). mouseover ( function()
{
$(".showhide").show();
}). mouseout ( function()
{
$(".showhide").hide();
});
//Show link
$(".showlink").click(function()
{
$(".imagebox").css(max-height,);
$(".showlink").hide();
$(".hidelink").show();
});
//Hide link
$(".hidelink").click(function()
{
$(".imagebox").css(max-height,100px);
$(".hidelink").hide();
$(".showlink").show();
});
});
</script>//HTML code
show
hide
</div>CSS 代码
.imagebox{
display:block;
position:relative;
overflow:hidden
}
.hidelink{
display:none;
}
.showhide{
padding:5px;
border-top:dashed 1px #333;
border-bottom:dashed 1px #333;
background:#F2f2f2 none repeat scroll 0 0;
bottom:0;
cursor:pointer;
display:block;
height:18px;
left:0;
line-height:18px;
padding-left:5px;
position:absolute;
width:100%;
}