This plugin displays items from a json file or a database. Only the first items are loaded, the others are not loaded until user scrolls to them or click on the next button.
JQuery Loader is the perfect plugin to display long pages of articles like a blog or the pictures of a gallery.
Choose the number items to load each time. The plugin is compatible with Isotope Plugin to display, filter & sort layouts.
Based on HTML5 - CSS3 - JQuery - (Optional: Bootstrap 3.x - Isotope)
Thank you for purchasing our plugin. If you have any questions that are beyond the scope of this help file, please contact us. Thanks so much!
To implement Lazy Loader on a page, you need to link the following CSS and JS files.
<!-- JQuery --> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <!-- Bootstrap 3 / Optional --> <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"> <script src="bootstrap/js/bootstrap.min.js"></script> <!-- Lazy Loader plugin --> <link rel="stylesheet" href="jquery-lazyloader/css/lazyloader.css"> <script src="jquery-lazyloader/js/lazyloader.js"></script>
Then, all that you have to do is call Lazy Loader on your page and customize the json file or the ajax loader (with your database informations to begin: db.php).
$(function(){ $('.lazy-wrapper').lazyLoader({ ajaxLoader: 'get_datas.php' // script that gets items (from a database for example) }); });
<div class="lazy-wrapper"></div>
You can also use JSON file to define your places. Simply enter the url of this file instead of the default array of places.
$(function(){ $('.lazy-wrapper').lazyLoader({ jsonFile: 'datas.json' // alternative method to the ajax loader (path to json file) }); });
JSON example:
{ "items": [ {"html": "<div class=\"lazyItem\"><img src=\"images/img_1.jpg\" ><span class=\"lazyContent\"><h3>Image 1</h3></span></div>"}, {"html": "<div class=\"lazyItem\"><img src=\"images/img_2.jpg\";><span class=\"lazyContent\"><h3>Image 2</h3></span></div>"}, {"html": "<div class=\"lazyItem\"><img src=\"images/img_3.jpg\"><span class=\"lazyContent\"><h3>Image 3</h3></span></div>"} ] }
Name | Expected type / values | Description | Example |
---|---|---|---|
ajaxLoader | path to the file | script that gets the items (from a database for example) | get_datas.php |
jsonFile | path to the file | alternative method to the ajax loader | data.json |
records | integer | total number of records to load | |
limit | integer | number of items to load first and each time | |
offset | integer | start position (1 to start on first item, 2 for 1xlimit+1, 3 for 2xlimit+1...) | |
mode | "scroll" or "click" | method used to load more items (click on a button or on scroll down) | |
more_caption | text | caption of the "more" button | "Load more" |
isIsotope | true or false | run Isotope plugin | |
isotopeResize | integer | number of columns if isotope is enabled |