Implement waterfall stream Layout Based on JavaScript and javascript waterfall

Source: Internet
Author: User

Implement waterfall stream Layout Based on JavaScript and javascript waterfall

The example in this article explains the code for implementing waterfall flow layout using native JavaScript and shares it with you for your reference. The specific content is as follows:

:

Code:

HTML

<!DOCTYPE html>

CSS code:

*{   margin: 0px;   padding: 0px;}#container{   position: relative;}.box{   padding: 5px;   float: left;}.box_img{   padding: 5px;   border: 1px solid #cccccc;   box-shadow: 0 0 5px #ccc;   border-radius: 5px;}.box_img img{   width: 150px;   height:auto;}

Js Code:

Window. onload = function () {imgLocation ("container", "box"); var imgData = {"data": [{"src": "2.jpg"}, {" src ": "3.jpg" },{" src ":" 4.jpg" },{ "src": "5.jpg" },{" src ":" 6.jpg" },{ "src": "7.jpg "}, {"src": "8.jpg"},]}; window. onscroll = function () {if (checkFlag () {var cparent = document. getElementById ("container"); for (var I = 0; I 

I hope this article will help you learn about javascript programming.

Articles you may be interested in:
  • Js-implemented beauty falls stream effect code
  • Implementation of javascript adaptive width waterfall stream
  • Pure js enables waterfall stream display of photos (automatically adapts to the window size)
  • Analysis of waterfall stream layout: Implementation of JS + absolute positioning
  • Example of a simple method for js to implement waterfall stream

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.