jq瀑布流代码


<style>
#zh{ position:fixed; width:100%; height:100%; background:url(images/bgblack.png); top:0; left:0; z-index:99999; text-align:center;}
#zh img{ margin-top:20%;}
.list_bg{padding-top: 20px;}
.list{width: 1000px;height: auto;padding-bottom: 10px;margin-bottom: 10px;position: relative;}
.list_postion{height: 60px;line-height:60px;background-color:#FAFAFA;}
.line{height:1px;width:100%;clear:both;background:#FFF;border-top:1px solid #E0E0E0;margin-top:20px !important;}
.list_postion a{border: 1px solid #DDD;border-radius: 2px;font-size:12px;margin-left:20px;background:#F2F2F2;padding:9px 15px 9px 15px;}
.list_img{width: 100%;margin-top:20px;position: relative;min-height:800px; visibility:hidden;}
.list_img li{width: 236px;height: auto;overflow: hidden;position: absolute;left:25%;top:0;-webkit-transition: opacity .4s ease-in-out;-moz-transition: opacity .4s ease-in-out;-o-transition: opacity .4s ease-in-out;box-shadow:0px 1px 3px rgba(0,0,0,0.3);background-color:#fff;}
.list_img li a{display:block;}
.list_img li a img{margin:15px 15px 0px 15px;}
.list_img li a img:hover{filter:alpha(opacity=50);-moz-opacity:0.5;-khtml-opacity: 0.5;opacity: 0.5;}
.list_img li .title,.list_img li .description{clear: both;padding: 10px 0;font-size: 12px;color:#999;display: block;padding: 0 16px;margin: 10px 0;line-height: 1.35em;overflow: hidden;word-wrap: break-word}
.list_img li .title{ color:#333; font-family:"微软雅黑"; font-size:12px; font-weight:bolder;}
.list_img li .bottom{background: #FAFAFA;color: #999;border-top: 1px solid #F2F2F2;background: #FAFAFA;position: relative;}
.list_img li .bottom a{color: #39F}
.list_img li .bottom .text{height: auto;padding: 8px 15px 8px 15px;line-height: 1.5}
.list_img li .bottom .text .inner{font-size:12px;height: auto;overflow: hidden}
.kw{ background-color:#fff !important; }
.kw .inner{ color:#39f; text-align:right;}
</style>
<div class="list">
<ul class="list_img">
<li>
<a href="#" target="_blank"><img src="http://file.newsccn.com/images/2014/0504/20140504015406825.jpg" width="206" alt="上海一老式居民楼因煤气爆炸倒塌 已致2死4伤"></a>
<p class="title">上海一老式居民楼因煤气爆炸倒塌 已致2死4伤</p>
<div class="convo attribution clearfix bottom">
<div class="text">
<div class="inner">5月4日5时许,上海市新港路一老式居民楼因煤气爆炸发生倒塌。</div>
</div>
</div>
<div class="convo attribution clearfix bottom kw">
<div class="text">
<div class="inner">
<a href="#" style="display:inline" target="_blank">立交桥</a> / <a href="#" style="display:inline" target="_blank">火灾</a> / <a href="#" style="display:inline" target="_blank">桥梁坍塌</a>
</div>
</div>
</div>
</li>
<li>
<a href="#" target="_blank"><img src="http://file.newsccn.com/images/2014/0505/20140505102341915.jpg" width="206" alt="广东高州在建桥梁坍塌已致死11人"></a>
<p class="title">广东高州在建桥梁坍塌已致死11人</p>
<div class="convo attribution clearfix bottom">
<div class="text">
<div class="inner">广东一座在建石拱桥3日发生坍塌事故,已致死11人。</div>
</div>
</div>
<div class="convo attribution clearfix bottom kw">
<div class="text">
<div class="inner">
<a href="#" style="display:inline" target="_blank">立交桥</a> / <a href="#" style="display:inline" target="_blank">火灾</a> / <a href="#" style="display:inline" target="_blank">桥梁坍塌</a>
</div>
</div>
</div>
</li>
<li>
<a href="#" target="_blank"><img src="http://file.newsccn.com/images/2014/0506/20140506101618921.jpg" width="206" alt="建筑物水中倒影 城市之美尽在此"></a>
<p class="title">建筑物水中倒影 城市之美尽在此</p>
<div class="convo attribution clearfix bottom">
<div class="text">
<div class="inner">建筑物本身与它在水中的倒影交相辉映,带给人一种不一样的观赏感受。</div>
</div>
</div>
<div class="convo attribution clearfix bottom kw">
<div class="text">
<div class="inner">
<a href="#" style="display:inline" target="_blank">立交桥</a> / <a href="#" style="display:inline" target="_blank">火灾</a> / <a href="#" style="display:inline" target="_blank">桥梁坍塌</a>
</div>
</div>
</div>
</li>
<li>
<a href="#" target="_blank"><img src="http://file.newsccn.com/images/2014/0506/20140506095838222.jpg" width="206" alt="南宁城中村现大规模“”"></a>
<p class="title">南宁城中村现大规模“”</p>
<div class="convo attribution clearfix bottom">
<div class="text">
<div class="inner">广西南宁,城中村大规模“亲嘴楼”惊现大量空中“棚户区”。</div>
</div>
</div>
<div class="convo attribution clearfix bottom kw">
<div class="text">
<div class="inner">
<a href="#" style="display:inline" target="_blank">立交桥</a> / <a href="#" style="display:inline" target="_blank">火灾</a> / <a href="#" style="display:inline" target="_blank">桥梁坍塌</a>
</div>
</div>
</div>
</li>
<li>
<a href="#" target="_blank"><img src="http://file.newsccn.com/images/2014/0506/20140506023718582.jpg" width="206" alt="英国52岁男子5年花500万改建复古老房"></a>
<p class="title">英国52岁男子5年花500万改建复古老房</p>
<div class="convo attribution clearfix bottom">
<div class="text">
<div class="inner">英国男子将他的都铎老屋改造成一座具有16世纪风格的房子。</div>
</div>
</div>
<div class="convo attribution clearfix bottom kw">
<div class="text">
<div class="inner">
<a href="#" style="display:inline" target="_blank">立交桥</a> / <a href="#" style="display:inline" target="_blank">火灾</a> / <a href="#" style="display:inline" target="_blank">桥梁坍塌</a>
</div>
</div>
</div>
</li>
<li>
<a href="#" target="_blank"><img src="http://file.newsccn.com/images/2014/0506/20140506022322150.jpg" width="206" alt="重庆四川美术学院修建城堡校门"></a>
<p class="title">重庆四川美术学院修建城堡校门</p>
<div class="convo attribution clearfix bottom">
<div class="text">
<div class="inner">重庆四川美术学院正在修建的酷似城堡的校门惹争议。</div>
</div>
</div>
<div class="convo attribution clearfix bottom kw">
<div class="text">
<div class="inner">
<a href="#" style="display:inline" target="_blank">立交桥</a> / <a href="#" style="display:inline" target="_blank">火灾</a> / <a href="#" style="display:inline" target="_blank">桥梁坍塌</a>
</div>
</div>
</div>
</li>
<li>
<a href="#" target="_blank"><img src="http://file.newsccn.com/images/2014/0506/20140506040709905.jpg" width="206" alt="上海倒楼之后棚户区不忍直视"></a>
<p class="title">上海倒楼之后棚户区不忍直视</p>
<div class="convo attribution clearfix bottom">
<div class="text">
<div class="inner">上海市老式居民楼倒了,随之浮出水面的是12年都没有拆掉的棚户区。</div>
</div>
</div>
<div class="convo attribution clearfix bottom kw">
<div class="text">
<div class="inner">
<a href="#" style="display:inline" target="_blank">立交桥</a> / <a href="#" style="display:inline" target="_blank">火灾</a> / <a href="#" style="display:inline" target="_blank">桥梁坍塌</a>
</div>
</div>
</div>
</li>
<li>
<a href="#" target="_blank"><img src="http://file.newsccn.com/images/2014/0506/20140506043229932.jpg" width="206" alt="湖北宜昌4s店楼顶层成“停车场” 停了50余辆车"></a>
<p class="title">湖北宜昌4s店楼顶层成“停车场” 停了50余辆车</p>
<div class="convo attribution clearfix bottom">
<div class="text">
<div class="inner">5月4日,在湖北宜昌港窑路附近,一家小轿车4S店楼顶停了50余辆车。</div>
</div>
</div>
<div class="convo attribution clearfix bottom kw">
<div class="text">
<div class="inner">
<a href="#" style="display:inline" target="_blank">立交桥</a> / <a href="#" style="display:inline" target="_blank">火灾</a> / <a href="#" style="display:inline" target="_blank">桥梁坍塌</a>
</div>
</div>
</div>
</li>
<li>
<a href="#" target="_blank"><img src="http://file.newsccn.com/images/2014/0507/20140507093543735.jpg" width="206" alt="加拿大一派对引2000人狂欢致豪宅被毁"></a>
<p class="title">加拿大一派对引2000人狂欢致豪宅被毁</p>
<div class="convo attribution clearfix bottom">
<div class="text">
<div class="inner">加拿大一豪宅举办派对,结果豪宅被2000多名狂欢者疯狂破坏。</div>
</div>
</div>
<div class="convo attribution clearfix bottom kw">
<div class="text">
<div class="inner">
<a href="#" style="display:inline" target="_blank">立交桥</a> / <a href="#" style="display:inline" target="_blank">火灾</a> / <a href="#" style="display:inline" target="_blank">桥梁坍塌</a>
</div>
</div>
</div>
</li>
<li>
<a href="#" target="_blank"><img src="http://file.newsccn.com/images/2014/0507/20140507101139869.jpg" width="206" alt="南京夫子庙拆违建 户主持刀抗拒"></a>
<p class="title">南京夫子庙拆违建 户主持刀抗拒</p>
<div class="convo attribution clearfix bottom">
<div class="text">
<div class="inner">城管欲拆除小区搭盖的阳光房,男子手持菜刀与警方对峙。</div>
</div>
</div>
<div class="convo attribution clearfix bottom kw">
<div class="text">
<div class="inner">
<a href="#" style="display:inline" target="_blank">立交桥</a> / <a href="#" style="display:inline" target="_blank">火灾</a> / <a href="#" style="display:inline" target="_blank">桥梁坍塌</a>
</div>
</div>
</div>
</li>
</ul>
</div>
<script type="text/javascript">
var margin = 18;
var marginT = 18;
var li = $(".list_img>li");
var li_w = li[0].offsetWidth + margin;
var speed = 1000;
function sortMin(arr) {
var a = b = 0;
a = Math.min.apply(null, arr);
for (var i = 0; i < arr.length; i++) {
if (a == arr[i]) {
b = i;
}
}
return a + "|" + b;
}
function ulh(arr) {
var a = sortMin(arr).split("|");
var hei = Number(a[0]) + li.eq(a[1]).height() + 50;
$(".list_img").height(hei);
}
function pbl() {
$("#zh").remove();
$(".list_img").css("visibility", "visible");
var $maxWidth = li.parent("ul").width();
var $l_num = Math.round(li.parent("ul").width() / li_w);
var l_h_arr = new Array();
li.each(function(i) {
var $height = $(this).height() + marginT;
if (i < $l_num) {
var $top = 0;
var $index = $(this).index();
l_h_arr[i] = $height;
} else {
var Arr = sortMin(l_h_arr).split("|");
$index = Arr[1];
$top = Arr[0];
l_h_arr[$index] += $height;
}
var $left = li_w * $index;
$(this).animate({left:$left},‘slow‘).delay(100).animate({top:$top}, {easing:"swing",duration:speed});
});
ulh(l_h_arr);
}
window.onload = function() {pbl();};
window.onresize = function() {pbl();};
</script>

需要分页,没有自动加载效果。

时间: 2024-08-24 15:38:30

jq瀑布流代码的相关文章

jquery 瀑布流代码 [简约]

HTML: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>瀑布流代码</title> <link rel="stylesheet" type="text/css" href="static/css/style.css"> </

ios图片瀑布流代码

ios瀑布流,实现简单的瀑布流视图布局,可以显示网络图片,下拉刷新,上拉加载更多. 下载:http://www.huiyi8.com/sc/9087.html ios图片瀑布流代码,布布扣,bubuko.com

瀑布流代码,简洁版 带分页

接上一篇   瀑布流代码,简洁版 的功能之上添加分页的功能 Index.cshtml @using PagedList.Mvc @model PagedList.StaticPagedList<int> @{ ViewBag.Title = "瀑布流"; Layout = "~/Views/Shared/_Layout.cshtml"; } @section header{ <script src="~/Scripts/jquery-ui

javascript瀑布流代码实例

javascript瀑布流代码实例:现在瀑布流效果大行其道,各种网站都有应用,尤其是专业的图片类型的网站,本站在特效下载专区也有此应用,当然实现此效果的方法有多种,下面是一段瀑布流代码实例供大家参考. <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title&

jquery实现的瀑布流代码实例

jquery实现的瀑布流代码实例:瀑布流现在很多网站都有应用,本站的特效下载专区也有应用,图片的加载会根据下拉条滚动实现的,实现了需要多少加载多少的功能,可以有效的提高网站的执行效率,下面是一段网络上的代码实例,供大家参考.代码实例如下: function lazyload(option){ var settings = { defObj: null, defHeight: 0 }; settings = $.extend(settings, option || {}); var defHeig

jquery实现简单瀑布流代码

测试环境:ie8 ff13.0.1  chrome22 可以将分页获取的内容依次填入四个div中,瀑布流的分页可以以多页(比如5页)为单位二次分页,这样可以减少后台算法的复杂度 [html] view plaincopy <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&

瀑布流代码,简洁版

最近想实现数据的延迟加载,网上找一下有很的列子,看了Masonry的例子启发,自己写了一个很简单的例子(仅限于每列的宽固定高一致,并不算是真正意义的瀑布流). View页面. @{ ViewBag.Title = "瀑布流"; Layout = "~/Views/Shared/_Layout.cshtml"; } @section header{ <script src="~/Scripts/jquery-ui-1.8.24.min.js"

两种方式实现瀑布流

一.浮动式瀑布流 实现要点: 1.设定列数,定下框架. 2.在ul中创建新节点li,在li中添加img节点,形成整体结构. 3.写最短列函数,每次创建的img保证在最小列下追加. 4.写滚动事件,在拖到最下方能自动加载 浮动式定位代码: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <style type="text/css"> *{ margin

网友微笑分享原创Jquery实现瀑布流特效

首先非常感谢网友微笑的无私分享,此Jquery特效是一款非常流行和实用的瀑布流布局,核心代码只有几十行,是我见过代码量最少的瀑布流布局,非常适合网友们学习哦,希望大家好好看一下这个Jquery特效的原代码,里面的每个功能注释写得非常详细.. 主要包括了以下几个功能函数:1.瀑布流主函数2.获取高度最小的列的函数3.判断请求数据的开关的函数4.请求数据加载的样式的函数 瀑布流代码如下: JS与CSS代码 /** * 作者:微笑 * QQ:904835003 * 邮箱:[email protecte