This tutorial will show you how to create a jQuery responsive image to show the gallery effect. All the images are arranged in the form of a grid, and some of the grids are flipped at random to switch between images. This effect can be used as a background or decoration on our website. Jquery. gridrotator is a very practical responsive Image Display gallery plug-in. This image display gallery plug-in arranges images in the same way as a grid, and then randomly flip the images in a grid to display another image. There are 6 effects in total.
HTML structure:
The HTML structure is very simple.
Call plug-ins
$(function() { $( '#ri-grid' ).gridrotator();});
Do not forget to introduce the jQuery and jquery. gridrotator. js files.
Optional Parameter
// number of rowsrows : 4, // number of columns columns : 10, // rows/columns for different screen widths// i.e. w768 is for screens smaller than 768 pixelsw1024 : { rows : 3, columns : 8}, w768 : { rows : 3, columns : 7}, w480 : { rows : 3, columns : 5}, w320 : { rows : 2, columns : 4}, w240 : { rows : 2, columns : 3}, // step: number of items that are replaced at the same time// random || [some number]// note: for performance issues, the number should not be > options.maxStepstep : 'random',maxStep : 3, // prevent user to click the itemspreventClick : true, // animation type// showHide || fadeInOut || slideLeft || // slideRight || slideTop || slideBottom || // rotateLeft || rotateRight || rotateTop || // rotateBottom || scale || rotate3d || // rotateLeftScale || rotateRightScale || // rotateTopScale || rotateBottomScale || randomanimType : 'random', // animation speedanimSpeed : 500, // animation easingsanimEasingOut : 'linear',animEasingIn : 'linear', // the item(s) will be replaced every 3 seconds// note: for performance issues, the time "can't" be < 300 msinterval : 3000,// if false the animations will not start// use false if onhover is true for exampleslideshow : true,// if true the items will switch when hoveredonhover : false,// ids of elements that shouldn't changenochange : []
When you define the grid size, you should note that all images will be immediately displayed in the grid. For example, if you have 50 images and define four rows and five columns, 20 images will be displayed in the grid, and 30 others will be used for image flip switching.
The above is all the content of this article. I hope you will like it.