Page 1 of 11
Forum moderator: bigblog 
uCoz Community » For Webmasters » Design Customization » AJAX pagination problem.
AJAX pagination problem.
Skan
Posts: 40
Reputation: 0

Message # 1 | 11:10 AM
When the page is changed through AJAX pagination it won't go to the top.

http://madgoat-studio.com/blog/

Press the page 2 (or any page), after the page 2 loads it will not start from the top. How can I make it start from the top on page change?
Sunny
Posts: 9296
Reputation: 456

Message # 2 | 2:39 PM
Skan, this is how the ajax pagination works.
I'm not active on the forum anymore. Please contact other forum staff.
Skan
Posts: 40
Reputation: 0

Message # 3 | 3:27 PM
So there's no workaround?
steven4u
Posts: 73
Reputation: 8

Message # 4 | 6:52 PM
as Sunny said, ajax allow you to refresh only a part of the website in order to save time and bandwidth, but you can customize it to go to the top of the website on each page clicked, how ?

Use the scrollto() method :

Code
window.scrollTo(x-coord, y-coord);


to go to the top just set x-coord and y-coord to 0 like this :

Code
window.scrollTo(0,0);


you need to edit your script and add it in the "Onclick" parameter, here's an example of the page 2 link how to look like after editing :

this is the original : ( does not go to the top)
Code
<a class="swchItem" href="/blog?page2" onclick="spages('2',this);return false;"><span>2</span></a>


edited one (goes to the top on each page)
Code
<a class="swchItem" href="/blog?page2" onclick="window.scrollTo(0,0);spages('2',this);return false;"><span>2</span></a>

A person who never made a mistake never tried anything new
Post edited by steven4u - Thursday, 2015-12-03, 6:55 PM
uCoz Community » For Webmasters » Design Customization » AJAX pagination problem.
Page 1 of 11
Search: