Jquery. gridrotator achieves responsive Image Display gallery Effects
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.
?
1 2 3 4 5 6 7 |
<Div id = "ri-grid" class = "ri-grid ri-grid-size-1 ri-shadow"> <Ul> <Li> <a href = "#"> </a> </li> <Li> <a href = "#"> </a> </li> <! --... --> </Ul> </Div> |
Call plug-ins
?
1 2 3 |
$ (Function (){ $ ('# Ri-grid'). gridrotator (); }); |
Do not forget to introduce the jQuery and jquery. gridrotator. js files.
Optional Parameter
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
// Number of rows Rows: 4, // Number of columns Columns: 10, // Rows/columns for different screen widths // I. e. w768 is for screens smaller than 768 pixels W1024 :{ 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 shocould not be> options. maxStep Step: 'rand ', MaxStep: 3, // Prevent user to click the items PreventClick: true, // Animation type // ShowHide | fadeInOut | slideLeft | // SlideRight | slideTop | slideBottom | // RotateLeft | rotateRight | rotateTop | // RotateBottom | scale | rotate3d | // RotateLeftScale | rotateRightScale | // RotateTopScale | rotateBottomScale | random AnimType: 'random ', // Animation speed AnimSpeed: 500, // Animation easings AnimEasingOut: 'linear ', AnimEasingIn: 'linear ', // The item (s) will be replaced every 3 seconds // Note: for performance issues, the time "can't" be <300 MS Interval: 3000, // If false the animations will not start // Use false if onhover is true for example Slideshow: true, // If true the items will switch when hovered Onhover: false, // Ids of elements that shouldn't change Nochange: [] |
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.