In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "how to achieve the waterfall flow effect of unlimited loading of pictures by HTML5". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to achieve the waterfall flow effect of unlimited loading of pictures by HTML5"!
The code is as follows:
JQuery Infinite load Waterfall flow / * tag redefinition * / body {padding:0;margin:0;background:#ddd url (/ jscss/demoimg/201312/bg55.jpg) repeat;} img {border:none;} a {text-decoration:none;color:#444;} a:hover {color:#999;} # title {width:600px;margin:20px auto;text-align:center;} / * define keyframes * / @-webkit-keyframes shade {from {opacity:1 } 15% {opacity:0.4;} to {opacity:1;}} @-moz-keyframes shade {from {opacity:1;} 15% {opacity:0.4;} to {opacity:1;}} @-ms-keyframes shade {from {opacity:1;} 15% {opacity:0.4;} to {opacity:1;} @-o-keyframes shade {from {opacity:1;} 15% {opacity:0.4;} to {opacity:1 } @ keyframes shade {from {opacity:1;} 15% {opacity:0.4;} to {opacity:1;}} / * wrap * / # wrap {width:auto;height:auto;margin:0 auto;position:relative;} # wrap .box {width:280px;height:auto;padding:10px;border:none;float:left;} # wrap .box .info {width:280px;height:auto;border-radius:8px;box-shadow:0 0 11px # 666 } # wrap .box .info .pic {width:260px;height:auto;margin:0 auto;padding-top:10px;} # wrap .box .info .pic: hover {- webkit-animation:shade 3s ease-in-out 1;-moz-animation:shade 3s ease-in-out 1;-ms-animation:shade 3s ease-in-out 1;-o-animation:shade 3s ease-in-out 1; animation:shade 3s ease-in-out 1;} # wrap .box .info .pic img {width:260px Border-radius:3px;} # wrap .box .info .title {width:260px;height:40px;margin:0 auto;line-height:40px;text-align:center;color:#666;font-size:18px;font-weight:bold;overflow:hidden;} _ window.onload = function () {/ / run the waterfall flow main function PBL ('wrap','box') / / Simulation data var data = [{'src':'1.jpg','title':' picture title'}, {'src':'2.jpg','title':' picture title'}, {'src':'3.jpg','title':' picture title'}, {'src':'4.jpg','title':' picture title'}, {'src':'5.jpg','title':' picture title'} {'src':'6.jpg','title':' picture title'}, {'src':'7.jpg','title':' picture title'}] / / set scrolling load _ window.onscroll = function () {/ / verify data request if (getCheck ()) {var wrap = document.getElementById ('wrap'); for (i in data) {/ / create box var box = document.createElement (' div'); box.className = 'box'; wrap.appendChild (box); / / create info var info = document.createElement (' div'); info.className = 'info'; box.appendChild (info) / / create pic var pic = document.createElement ('div'); pic.className =' pic'; info.appendChild (pic); / / create img var img = document.createElement ('img'); img.src =' / jscss/demoimg/201312/'+ data [I] .src; img.style.height = 'auto'; pic.appendChild (img); / / create title var title = document.createElement (' div'); title.className = 'title'; info.appendChild (title) / / create a tag var a = document.createElement ('a'); a [XSS _ clean] = data [I] .title; title.appendChild (a);} PBL ('wrap','box');} / * * Waterfall flow main function * @ param wrap [Str] ID * @ param box [Str] the class name of each box * / function PBL (wrap,box) {/ / 1. Get the outer layer and each box var wrap = document.getElementById (wrap); var boxs = getClass (wrap,box); / / 2. Get the number of columns that can be displayed on the screen var boxW = boxs [0] .offsetWidth; var colsNum = Math.floor (document.documentElement.clientWidth/boxW); wrap.style.width = boxW*colsNum+'px';// for the outer assignment width / / 3. Loop out all the box and arrange var everyH = [] according to the waterfall flow; / / define an array to store the height for of each column (var I = 0; I
< boxs.length; i++) { if(i=index) return; $(box).css({ 'position':'absolute', 'top':top, "left":left, "opacity":"0" }); $(box).stop().animate({ "opacity":"1" },999); getStartNum = index;//更新请求数据的条数位置 } 瀑布流效果的学习By Smile.Picture title
Picture title
Picture title
Picture title
Picture title
Picture title
At this point in the picture title, I believe you have a deeper understanding of "how to achieve the waterfall flow effect of unlimited loading of pictures by HTML5". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.