如何使用Jquery和CSS折叠图像

这篇文章主要介绍“如何使用Jquery和CSS折叠图像”,在日常操作中,相信很多人在如何使用Jquery和CSS折叠图像问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”如何使用Jquery和CSS折叠图像”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!

站在用户的角度思考问题,与客户深入沟通,找到射洪网站设计与射洪网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:成都网站建设、成都网站制作、企业官网、英文网站、手机端网站、网站推广、域名与空间、网页空间、企业邮箱。业务覆盖射洪地区。

如何使用Jquery和CSS进行折叠图像。Orkut.com在更新图像碎片时实现了这个概念,碎片以折叠样式显示图像以减少网页高度。这是使用mouseover,mouseout和css Jquery函数的非常简单的脚本。


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



$(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();
});

});

//HTML code


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%;
}

到此,关于“如何使用Jquery和CSS折叠图像”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注创新互联网站,小编会继续努力为大家带来更多实用的文章!


网站题目:如何使用Jquery和CSS折叠图像
地址分享:http://ybzwz.com/article/ijsphd.html