Masonry ImagesLoaded Infinitescroll 自动分页图片预载瀑布流实现.docx

上传人:b****2 文档编号:2435027 上传时间:2022-10-29 格式:DOCX 页数:11 大小:18.40KB
下载 相关 举报
Masonry ImagesLoaded Infinitescroll 自动分页图片预载瀑布流实现.docx_第1页
第1页 / 共11页
Masonry ImagesLoaded Infinitescroll 自动分页图片预载瀑布流实现.docx_第2页
第2页 / 共11页
Masonry ImagesLoaded Infinitescroll 自动分页图片预载瀑布流实现.docx_第3页
第3页 / 共11页
Masonry ImagesLoaded Infinitescroll 自动分页图片预载瀑布流实现.docx_第4页
第4页 / 共11页
Masonry ImagesLoaded Infinitescroll 自动分页图片预载瀑布流实现.docx_第5页
第5页 / 共11页
点击查看更多>>
下载资源
资源描述

Masonry ImagesLoaded Infinitescroll 自动分页图片预载瀑布流实现.docx

《Masonry ImagesLoaded Infinitescroll 自动分页图片预载瀑布流实现.docx》由会员分享,可在线阅读,更多相关《Masonry ImagesLoaded Infinitescroll 自动分页图片预载瀑布流实现.docx(11页珍藏版)》请在冰豆网上搜索。

Masonry ImagesLoaded Infinitescroll 自动分页图片预载瀑布流实现.docx

MasonryImagesLoadedInfinitescroll自动分页图片预载瀑布流实现

ASP.NETMVC4+Masonry+ImagesLoaded+Infinitescroll

自动分页+图片预载 瀑布流实现

Masonry 下载:

 

所需文件:

masonry.pkgd.min.js

$(“#container”).masonry({

 //options 设置选项

 itemSelector:

“.item”,//子类元素选择器

 columnWidth:

240,//一列的宽度 ,包括边距 220+10+10

 isAnimated:

true,//使用jquery的布局变化,是否启用动画效果

 animationOptions:

{

 //jqueryanimate属性,动画效果选项。

比如渐变效果 Object{queue:

false,duration:

500}

 },

 gutterWidth:

0,//列的间隙

 isFitWidth:

true,//自适应宽度

 isResizable:

true,// 是否可调整大小

 isRTL:

false,//使用从右到左的布局

 });

Imagesloaded下载:

 http:

//desandro.github.io/imagesloaded/

所需文件:

imagesloaded.pkgd.min.js

varimgLoad=imagesLoaded('#container');

imgLoad.on('always',function(){

 console.log(imgLoad.images.length+'imagesloaded');

 //detectwhichimageisbroken

 for(vari=0,len=imgLoad.images.length;i

   varimage=imgLoad.images[i];

   varresult=image.isLoaded?

'loaded':

'broken';

   console.log('imageis'+result+'for'+image.img.src);

 }

});

infinite-scroll下载:

所需文件:

jquery.infinitescroll.js

$('#content').infinitescroll({

 navSelector :

"div.navigation",//导航的选择器,会被隐藏

 nextSelector:

"div.navigationa:

first",//包含下一页链接的选择器

 itemSelector:

"#contentdiv.post",//你将要取回的选项(内容块)

 debug       :

true,//启用调试信息

 loadingImg  :

"/img/loading.gif",//加载的时候显示的图片

                //默认采用:

"http:

//www.infinite-

 animate     :

true,//当有新数据加载进来的时候,页面是否有动画效果,默认没有

 extraScrollPx:

50,//滚动条距离底部多少像素的时候开始加载,默认150

 bufferPx    :

40,//载入信息的显示时间,时间越大,载入信息显示时间越短

 errorCallback:

function(){},//当出错的时候,比如404页面的时候执行的函数

 localMode   :

true//是否允许载入具有相同函数的页面,默认为false

 },function(arrayOfNewElems){

 //程序执行完的回调函数

});

 

View:

News.cshtml

    

        @foreach (var iteminModel.NewsItems)

       {

            

                

                    

                

                

                    @item.Title

                

                

                    @Html.Raw(item.Short)

                

                

                    @item.CreatedOn.ToString("D")

                    

                        @T("News.MoreInfo")

                

                

            

       }

    

    @Html.Pager(Model.PagingFilteringContext).QueryParam("pagenumber")

样式:

Css:

#masonry-container .post {

    width:

 230px;

    border:

 #ccc 1px solid;

    text-align:

 justify;

    margin:

 0px 20px 20px 0px;

    background:

 #e2e2e2;

    font-size:

 12px;

    -webkit-box-shadow:

 0 1px 3px #ccc;

    box-shadow:

 0 1px 3px #ccc;

    -webkit-transition:

 0.3s;

    -moz-transition:

 0.3s;

    -o-transition:

 0.3s;

    transition:

 0.3s;

    float:

 left;

}

 

 

#masonry-container .post:

hover {

    -webkit-box-shadow:

 0 0 3px #E3BB4D;

    box-shadow:

 0 0 3px #E3BB4D;

}

 

#masonry-container .post .newpic {

     width:

 228px;

     overflow:

hidden;

}

 

#masonry-container .post:

hover .newpic {

opacity:

 .9;

}

.post .newpic .postimg {

     width:

 228px;

     overflow:

hidden;

}

#masonry-container .post .newtitle {

    background-color:

#fff;

    line-height:

20px;

    font-weight:

bold;

    font-size:

14px;

    color:

#3F709E;

   padding:

10px 10px 0px 10px;

}

#masonry-container .post .newtext {

    background-color:

#fff;

   padding:

0px 10px 10px 10px;

    line-height:

20px;

}

#masonry-container .post .newtarg {

    background-color:

#eee;

    padding:

10px;

    line-height:

20px;

    border-top:

1px #ccc solid;

}

.newtarg a{

    float:

right;

    border:

 #ccc 1px solid;

    display:

block;

    width:

40px;

    text-align:

center;

}

#masonry-single ul.pagination {

    display:

none;

}

#infscr-loading {

    bottom:

 -30px;

    height:

 20px;

    left:

 45%;

    line-height:

 20px;

    position:

 absolute;

    text-align:

 center;

    width:

 120px;

    z-index:

 100;

}

#masonry-container .post .newpic img{

     width:

 228px;

}

#masonry-container .post .newpic {

  width:

 228px;

  display:

 block;

  background-color:

 #fff;

  background-position:

 center center;

  background-repeat:

 no-repeat;

}

#masonry-container .post .is-loading {

  background-color:

 #fff;

  background-image:

 url('../images/loader.gif');

}

#masonry-container .post .is-broken {

  background-image:

 url('http:

//desandro.github.io/imagesloaded/assets/broken.png');

  background-color:

 #be3730;

  width:

 120px;

}

#masonry-conta

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 医药卫生 > 基础医学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1