How do you make an infinite scroll page in Blogger?
Asked Answered
E

5

13

I have a blog and would like to make it infinite scroll so you don't have to click through pages and pages of posts. Can anyone help me with the code, its in HTML according to Blogger? Thanks :-)

Emmalynne answered 13/10, 2012 at 10:6 Comment(2)
Have you done any research? I'm sure there are tutorials out there...Zacharie
You'd have to check whether Blogger has a theme with that functionalityFlyfish
S
7

How to add infinite scrolling to Blogger blogs

Recently I read an interesting article, How to add infinite scrolling to Blogger blogs. If you are using Blogger's blog, you can follow the instructions and give your blog, an infinite scroll without much hassle.

The code for the widget is available on Google Code. Feel free to copy or adapt the code.

From their website, a few points worth mentioning:

  • This code uses jQuery library, so don’t forget to include it.
  • Custom template blogs may have to change the value of postContainerSelector variable in the code.
  • You have manually added +1 buttons to my blog. Dynamically loaded posts won’t have the +1 buttons initialised; to fix that issue, I had to call gapi.plusone.go() every time new posts are added to the page.
  • _WidgetManager is a JavaScript object present in Blogger blogs. You can query this object to find some page metadata. This code uses _WidgetManager to determine if the current page is showing a single post. Infinite scrolling is not meaningful when only a single post needs to be displayed.
Sexagenarian answered 13/10, 2012 at 12:42 Comment(0)
A
4

HTML has no way of achieving this, you need JavaScript.

First set up an event listener for the scroll event. When it fires compare the distance scrolled to the height of the document and window.

If that indicates you are near the document, use XMLHttpRequest to download more content, and then the usual DOM suspects to add that content to the page.

Adamant answered 13/10, 2012 at 10:9 Comment(0)
B
2

You can achieve this thru JQuery or JScript. HTML can not do this alone.

Here is some example how you can get this.

Buffington answered 13/10, 2012 at 10:18 Comment(0)
L
2

HTML doesn't specify absolutes in terms of height as it automatically allows for infinite scrolling (you can't say height="100%" for instance. In terms of CMS Blogs like blogger there should be user preferences available to say how many posts you want displayed, in the control panel. Alternatively if you are using a server side technology (e.g. php) with a database you can specify number of items displayed using record set paging.

Lakeishalakeland answered 13/10, 2012 at 12:36 Comment(0)
M
0

You need to add an event listener using JavaScript, means when a particular element comes to view port an event is fired and it fetches the data from some external resources. The data comes in JSON and you need to extract it and append the info in a DIV.
For this I have made a script which fetches the data from Google Docs using Jquery and the event is fired after you scroll to the bottom most portion. You can check the infinite scroll here

Mimosaceous answered 4/6, 2013 at 15:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.