Simplex Design blog : Infinite scrolling or load more effect for Blogger - part 3 |
Infinite scrolling or load more effect for Blogger - part 3 Posted: 10 Mar 2013 08:49 PM PDT This is the last past of series Infinite scrolling for Blogger. I will show you how to combine Infinite Ajax Scroll with other Jquery Plugin or scripts in your page. Because it too long, so I divide this post into 3 parts with detail as bellow: - Part 1: Basic usage of Jquery Ajax Scrolling and apply it to default Blogger template - Part 2: How to apply Infinite Scrolling technique to all Blogger templates. - Part 3: Combine this Jquery plugin with other plugin ( layout plugins such as Masonry, Isotape, or Disqus comment system, Google Analytics) Live Demo Part 3: How to combine Infinite Ajax Scroll plugin with other Jquer plugin or scripts.To understand what mentioned in this post, I recommend you all to read part 1 and part 2 of this series first. If you are familiar with Ajax scrolling plugin, you can skip to this part.When this script work, user scroll down page 1, it will load page 2. In this process, we have states as bellow: - User scroll down the page 1; - User scroll down to the end of page 1, start loading page 2; - Loading page 2; - Display page 2. According to these states, we have functions to handle each step as bellow: - beforePageChange: Is called when a user scrolls to next page, but before the new page is loaded. Returning false and cancel the load if not the end of page 1; any return value other than false will allow the pagination to proceed as normal. - onPageChange: Is called each time the user scrolls to an other page. - onLoadItems: Is called each time new page are loaded. - onRenderComplete: Is called each time new page complete loading and show the result in browser. Any script inserted in each page (page 1, page 2... ) must be put inside these functions. Why? Because scripts which inserted in your page are designed to execute when a page load in browser. But using Infinite Ajax Scroll, you don't refresh or click any button in browser to navigate to next page. Scripts on your page are not triggered. So it's the reason we need to put your scripts inside these functions to make them execute at the moment new page loaded.
How to put a script inside funtions aboveYou can refer to this:jQuery.ias({- Disqus script which showing comment number. jQuery.ias({Script that marked in red is Disqus script. - Masonry script jQuery.ias({- Google Analytics is a bit more difficult to integrate: jQuery.ias({ ConclusionThis post is general instruction with not go into detail. Because there are many scripts that you can use for blog, I can't list all them. I hope with this post, you can have a clue where to start. It's not so hard to integrate a script with Infinite Ajax Scroll, but you must understand your script first, base on this, you can put them inside Infinite Ajax Scroll Plugin's functions above. |
You are subscribed to email updates from SimplexDesign - free premium blogspot template To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 20 West Kinzie, Chicago IL USA 60610 |