Masonry Gallery component depends on Vue.js which contains a beautiful layout for the flow of the waterfall and the effect of miniature hills. The component of the selection of openings allows you to interior tabs/external or media width in a conditional popup window.
Compared to other applications, there is no need to determine the display and height of the image in the returned data. A very suitable option for the controlled serial control of the elements or displaying random elements.
Must Read: Horizontal Sort Waterfall Layout Component for Vue.js
How to make use of it:
Installation
npm install vue-masonry-gallery --save
Usage
import VueWMasonryGallery from "vue-masonry-gallery";
export default { name: "app", components: { VueMasonryGallery } };
<script src="path/to/vue/vue.js"></script> <script src="path/to/VueMasonryGallery.js"></script>
Props
props | type | default | description |
---|---|---|---|
width | Number | – | Container width(px), default is 100% relative to parent element width, Due to the responsiveness, all its parent’s width must be 100% relative to the browser window at this time, See the example after the table **If it is fixed width, you must set the width prop **, not just its parent element set a fixed width |
height | Number|String | – | Container height, the default unit px for the value of the Number type, the unit can be specified when the value is the type of String When you do not specify the height value, the default is relative to the height of the parent element 100%, then the parent element must have a height |
gap | Number | 20 | [Pc] space between pictures(px) |
mobileGap | Number | 8 | [Mobile] space between pictures(px) |
imgsArr | Array | [] | required Data used to render the masonry gallery stream Each array element is an object and must have src and href attributes.The src an attribute represents the SRC attribute of the pictureThe href an attribute represents the link to click to jump if your key is not src and href , you can use the two properties of srcKey and hrefKey to do the key value replacement. |
random | Boolean | false | The function of random display of items. The default option is ‘false’ – to run RANDOM sorting change it to ‘true’ |
srcKey | String | ‘src’ | When the key value of your picture address is not src , you can use this property to replace it. |
hrefKey | String | ‘href’ | When the key value of your picture address is not href , you can use this property to replace it. |
target | String | ‘blank’ ‘self’ ‘modal’ | A method of running a popup window that displays an image or redirects to an external URL |
perPage | Number | 13 | The number of items displayed the first time you load the page. |
imgWidth | Number | 330 | The width of the picture(px) |
maxCols | Number | 5 | Masonry shows the maximum number of columns |
linkRange | String | ‘card’ | Identify click to trigger jump link range value: ‘card’ Whole card range ‘img’ image range ‘custom’ Customize the link range through slots |
isRouterLink | Boolean | false | Render the a tag when the value is false Render the router-link component when the value is true |
reachBottomDistance | Number | 0 | The distance(px) from the bottom of the container when the scrolling triggers the scrollReachBottom event |
loadingDotCount | Number | 3 | The number of default loading animation dots |
loadingDotStyle | Object | null | The style object of the small dots in the default loading element |
loadingTimeOut | Number | 500 | Preloading events less than 500ms milliseconds do not display loading animations, increasing the user experience |
cardAnimationClass | String | ‘default-card-animation’ | the animation className for the card |
Event
event name | description |
---|---|
scrollReachBottom | When the scroll bar scrolls to the bottom, it is used to trigger a request for new image data |
preloaded | Trigger every time image preloading is completed |
click | Trigger when the card is clicked, look at an example under the table |
See Demo And Download
Official Website(parys-github): Click Here
This superior jQuery/javascript plugin is developed by parys-github. For extra advanced usage, please go to the official website.