• 欢迎访问开心洋葱网站,在线教程,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站,欢迎加入开心洋葱 QQ群
  • 为方便开心洋葱网用户,开心洋葱官网已经开启复制功能!
  • 欢迎访问开心洋葱网站,手机也能访问哦~欢迎加入开心洋葱多维思维学习平台 QQ群
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏开心洋葱吧~~~~~~~~~~~~~!
  • 由于近期流量激增,小站的ECS没能经的起亲们的访问,本站依然没有盈利,如果各位看如果觉着文字不错,还请看官给小站打个赏~~~~~~~~~~~~~!

[jQuery] 超实用的图片列表布局切换效果

JavaScript 水墨上仙 1335次浏览

jQuery 超实用的图片列表布局切换效果,这个效果相当实用,淘宝购物有这种效果,平时打开网页的时候是一种布局排列,当用户选择布局模式时,它会以动画方式切换,很有意思也挺新颖的。


<!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>
<title>jQuery 超实用的图片列表布局切换效果</title>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<style type="text/css">
body {
    font-size: 12px;
}
p.switch {
    width: 122px;
    height: 26px;
    margin-bottom: 15px;
    background: url(/jscss/demoimg/201008/switch_bg.gif) no-repeat;
}
a.switch_thumb {
    width: 34px;
    height: 26px;
    line-height: 26px;
    padding: 0;
    margin: 0 0 0 80px;
    display: block;
    background: url(/jscss/demoimg/201008/switch_btn.gif) no-repeat;
    outline: none;
    text-indent: -9999px;
}
a.swap {
    background-position: left bottom;
}
a:hover.switch_thumb {
    filter:alpha(opacity=75);
    opacity:.75;
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=75)";
}
ul.display {
    width: 744px;
    background: #222 none repeat scroll 0 0;
    border-right: 1px solid #333;
    border-top: 1px solid #333;
    margin: 0;
    padding: 0;
    overflow: hidden;
    clear: both;
}
ul.display li {
    width: 742px;
    float: left;
    margin: 0;
    padding: 10px 0;
    border: 1px solid;
    border-color: #111 #111 #333 #333;
}
ul.display li a {
    color: #DDD;
    text-decoration: none;
    font-size: 140%;
}
ul.display li .content_block {
    padding: 0 10px;
}
ul.display li .content_block h4 {
    margin: 0;
    padding: 5px;
}
ul.display li .content_block p {
    margin: 0;
    padding: 5px 5px 5px 241px; 
    color: #CCC;
}
ul.display li .content_block a img{ 
    border: 5px solid #ccc;
    background: #fff;
    margin: 0 15px 0 0;
    float: left;
}
ul.thumb_view li { 
    width: 246px; 
} 
ul.thumb_view li h4 { 
    display: inline;
}
ul.thumb_view li p { 
    display: none; 
}
ul.thumb_view li .content_block a img { 
    margin: 0 0 10px; 
}
</style>
<script type="text/javascript" src="/ajaxjs/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
    $("a.switch_thumb").toggle(function(){
        $(this).addClass("swap");
        $("ul.display").fadeOut("fast", function() {
            $(this).fadeIn("fast").addClass("thumb_view");
        });
    }, function () {
        $(this).removeClass("swap");
        $("ul.display").fadeOut("fast", function() {
            $(this).fadeIn("fast").removeClass("thumb_view");
        });
    }); 
});
</script>
</head>
<body>
<ul class="display">
	<li>
		<div class="content_block">
			<a href="#"><img src="/jscss/demoimg/201008/sample1.gif" alt="Sample"></a>
			<h4><a href="#">Sunflowa Media</a></h4>
			<p>Hey, I'm Airos Chou.</p>
			<p>I am a freelance web designer & graphic designer based in Shanghai, CN. I make Green Environment Protection website, accessible websites that are easy to use and easy for our life.</p>
		</div>
	</li>
	<li>
		<div class="content_block">
			<a href="#"><img src="/jscss/demoimg/201008/sample2.gif" alt="Sample"></a>
			<h4><a href="#">Sunflowa Media</a></h4>
			<p>Hey, I'm Airos Chou.</p>
			<p>I am a freelance web designer & graphic designer based in Shanghai, CN. I make Green Environment Protection website, accessible websites that are easy to use and easy for our life.</p>
		</div>
	</li>
	<li>
		<div class="content_block">
			<a href="#"><img src="/jscss/demoimg/201008/sample3.gif" alt="Sample"></a>
			<h4><a href="#">Sunflowa Media</a></h4>
			<p>Hey, I'm Airos Chou.</p>
			<p>I am a freelance web designer & graphic designer based in Shanghai, CN. I make Green Environment Protection website, accessible websites that are easy to use and easy for our life.</p>
		</div>
	</li>
</ul>
</body>
</html>


开心洋葱 , 版权所有丨如未注明 , 均为原创丨未经授权请勿修改 , 转载请注明[jQuery] 超实用的图片列表布局切换效果
喜欢 (0)
加载中……