mui 图片实现瀑布流显示
原文链接:http://www.bcty365.com/content-146-5320-1.html
- <body style="background-color: #f3f3f3;">
- <!-- 商品列表 -->
- <div class="twoRankedBox">
- <ul class="BoxLeft">
- </ul>
- <ul class="BoxRight">
- </ul>
- </div>
- </body>
- *{
- padding:0px;
- margin:0px;
- list-style: none;
- font-style:normal;
- font-family: arial;
- font-family: Microsoft YaHei,arial;
- }
- .twoRankedBox{
- margin:6px 8px;
- overflow: hidden;
- padding-bottom:25px;
- }
- .twoRankedBox ul{
- width:49%;
- float: left;
- }
- .twoRankedBox ul:last-child{
- margin-left:2%;
- }
- .twoRankedBox ul li{
- padding:5px;
- margin-bottom:6px;
- padding-bottom:8px;
- background-color: #FFFFFF;
- }
- .twoRankedBox ul li p:first-child{
- padding-top:0px;
- }
- .twoRankedBox ul li p{
- padding-top:4px;
- }
- .product_picture img{
- display: block;
- width:100%;
- }
- .product_np{
- overflow: hidden;
- line-height:20px;
- }
- .product_np a{
- display: block;
- overflow:hidden;
- text-overflow:ellipsis;
- white-space:nowrap;
- }
- .product_np a:first-child{
- font-size:0.9em;
- color:#58b7e3;
- width:65%;
- float: left;
- }
- .product_np a:last-child{
- font-size:0.8em;
- color:#f00;
- float: right;
- width:35%;
- text-align: right;
- }
- .product_ie{
- font-size:0.8em;
- color:#777;
- }
- for(var i=0;i<json.data.length;i++){
- var chtml = '<li><p class="product_picture"><img src="'+json.data[i].src+'"></p>'
- +'<p class="product_np"><a>'+json.data[i].name+'</a><a>¥'+json.data[i].price+'</a></p>'
- +'<p class="product_ie">'+json.data[i].details+'</p></li>'
- if($('.BoxLeft').height() < $('.BoxRight').height()){
- $('.BoxLeft').append(chtml);
- }else{
- $('.BoxRight').append(chtml);
- }
- }