
00

01
< ;div class="cell">

02
A brief analysis of waterfall flow layout
Toss: waterfall flow layout (implemented based on multi-column list fluid layout)
javascript waterfall flow, Brief analysis and suggestions of major waterfall flows
Because I use jquery a lot, I came up with the idea of making waterfall flow into a plug-in. Let’s borrow the beautiful pictures from Xunlei UED.
Take a look firstDemo
Publish the code
00
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
The following is a detailed description of the functions and default values of each attribute of the configuration parameter object opt.
column_width:204 //Waterfall flow is composed of columns. This parameter specifies the width of each column. This parameter will directly affect the number of columns in the waterfall flow
column_className:'waterfall_column' //The class name of the column, easy to customize the style
column_space:10 //The spacing between columns
cell_selector:'.cell' //The selector of the bricks to be arranged is limited to the container of the waterfall flow, that is, the plug-in obtains the brick elements through this selector, and is Find elements matching this selector within the waterfall container.
img_selector:'img' //Selector for the image to be loaded. If the theme content of the brick elements to be loaded by your waterfall flow is images of varying sizes, then this parameter is the selector of these images, and the plug-in needs to obtain these images for calculation.
auto_imgHeight:true //Do you need to automatically calculate the height of the image? If the size of the image is fixed, set this parameter to false
fadein:true // Whether to fade in and load
fadein_speed:600 //Fade in speed in milliseconds
insert_type:1 //Brick insertion method, 1 means inserting the shortest column, 2 means inserting in sequence
getResource:function(index,render){ } //Get the dynamic resource function, which must return a collection of brick elements. The first parameter index passed in is the number of times it has been loaded. The second parameter is the number of times it has been loaded. The first parameter is the rendering function, which can accept a collection of brick elements as a parameter. If you use ajax to load data, you must manually call the function to render after getting the data. This function is automatically triggered every time the bottom of the waterfall is reached to load more resources.
Comment time:
The content loaded by waterfall flow is generally pictures with the same width and different heights. If the height of the picture can be known in advance, it will be much simpler. But if not, you must wait until the picture is loaded before you can calculate the height of the picture. This This is the most annoying part of the waterfall flow. It is precisely because of this that if the height of the pictures is unknown, the order of insertion may be a little confusing, and the refresh order is different every time, because the order in which each picture is loaded is not the same. It's not fixed, maybe this time is faster, next time that is faster. Therefore, if the height of the image is not known in advance, the height of the entire brick will also be unknown. The height of the brick must be calculated after the image in the brick is loaded. If this is the case but you want to ensure the insertion order of bricks, it is recommended to insert bricks in sequence, that is, set the insert_type parameter to 2. Because it is a plug-in, ease of use must be considered, but the easier it is to use, the more complex the plug-in will be inside, and the number of loopholes and bugs will increase, so I will continue to improve this plug-in.
This plug-in supports IE6, chrome, firefox, opera, safari and other mainstream browsers.
AI-powered app for creating realistic nude photos
Online AI tool for removing clothes from photos.
Undress images for free
AI clothes remover
Swap faces in any video effortlessly with our completely free AI face swap tool!
Easy-to-use and free code editor
Chinese version, very easy to use
Powerful PHP integrated development environment
Visual web development tools
God-level code editing software (SublimeText3)
Frequently Asked Questions and Solutions for Front-end Thermal Paper Ticket Printing In Front-end Development, Ticket Printing is a common requirement. However, many developers are implementing...
JavaScript is the cornerstone of modern web development, and its main functions include event-driven programming, dynamic content generation and asynchronous programming. 1) Event-driven programming allows web pages to change dynamically according to user operations. 2) Dynamic content generation allows page content to be adjusted according to conditions. 3) Asynchronous programming ensures that the user interface is not blocked. JavaScript is widely used in web interaction, single-page application and server-side development, greatly improving the flexibility of user experience and cross-platform development.
There is no absolute salary for Python and JavaScript developers, depending on skills and industry needs. 1. Python may be paid more in data science and machine learning. 2. JavaScript has great demand in front-end and full-stack development, and its salary is also considerable. 3. Influencing factors include experience, geographical location, company size and specific skills.
How to merge array elements with the same ID into one object in JavaScript? When processing data, we often encounter the need to have the same ID...
Learning JavaScript is not difficult, but it is challenging. 1) Understand basic concepts such as variables, data types, functions, etc. 2) Master asynchronous programming and implement it through event loops. 3) Use DOM operations and Promise to handle asynchronous requests. 4) Avoid common mistakes and use debugging techniques. 5) Optimize performance and follow best practices.
Discussion on the realization of parallax scrolling and element animation effects in this article will explore how to achieve similar to Shiseido official website (https://www.shiseido.co.jp/sb/wonderland/)...
In-depth discussion of the root causes of the difference in console.log output. This article will analyze the differences in the output results of console.log function in a piece of code and explain the reasons behind it. �...
The latest trends in JavaScript include the rise of TypeScript, the popularity of modern frameworks and libraries, and the application of WebAssembly. Future prospects cover more powerful type systems, the development of server-side JavaScript, the expansion of artificial intelligence and machine learning, and the potential of IoT and edge computing.