PDA

View Full Version : Dynamic Ajax Content Scroll Problem



Monclee
02-14-2007, 04:45 PM
1) Script Title:

Dynamic Ajax Content

2) Script URL (on DD):

http://dynamicdrive.com/dynamicindex17/ajaxcontent.htm

3) Describe problem:

Well everything its working fine but there is just one little problem, I insert a document and at the bottom of it, has a Next link, the problem is that when the next part loads inside the div, the page stills on the bottom so you have to scroll all the way up to read from the beggining i have tried this.

<h3><a name="ini">Top</a></h3>
on the top of the next part of de doc.

and in the link:
<a href="javascript:ajaxpage('retrospectiva2.html#ini', 'polaroidfullbg');">next</a></span></p>

thanks.

Sorry about my poor english:D

Monclee
02-14-2007, 06:53 PM
After a deep search i finaly found the answer in this forum, sorry for posting, anyway, heres the answer i found. :)

You could try adding it here instead -

Replace:

Code:

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}

with:

Code:

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
{
document.getElementById(containerid).scrollTop=0;
document.getElementById(containerid).innerHTML=page_request.responseText
}
}

It did work here locally if I pasted the command into the address bar.