PDA

View Full Version : Dynamic Ajax Content Load State



defyinggravity
02-07-2007, 11:11 PM
1) Script Title: Dynamic Ajax Content Load State

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm

3) Describe problem: This script is really awesome and it works great, but I have a slight problem. I have it loading in a table with many pages being called in to the container (not all at once...lol) Some pages require overflow:auto and this is where the problem comes in. Let's say I scroll down to the bottom of any of my loaded pages within the container area and then go up to my navigation and choose another page to go to it loads from the previous pages state, meaning that it loads the new page as if I had already scrolled to the bottom of it. Is there a way around this?

Thanks for a great script...will definitely give you guys a back link on my site.

Thanks Nic

jscheuer1
02-08-2007, 05:57 AM
I'm not sure I understand completely or, even if I do if this will fix it but, it is worth a shot:


<a href="javascript:ajaxpage('test.htm', 'contentarea');" onmouseup="window.scrollTo(0,0);">test</a>

defyinggravity
02-08-2007, 07:44 AM
Hi,

The code that you gave me looked like it would do the trick but didn't. Think you might have a better idea of what the problem really is if you check the functionality of the page.

www.defyinggravity.co.za/home2.html

Scroll down on any page and then use the navigation to select another page. You will see it loads from the previous pages position. This only happens in IE, NS and Opera. Firefox as we all know is perfect...lol

Thanks for the help

defyinggravity
02-08-2007, 09:50 AM
Sorry hope that did not send you on another tangent

jscheuer1
02-08-2007, 11:06 AM
I thought it was the page but, looks like it is the division and maybe that wasn't so much a typo as it was you being psychic. Give this a shot:


<a href="javascript:ajaxpage('test.htm', 'contentarea');" onmouseup="document.getElementById('rightcolumn').scrollTop=0);">test</a>

Also, this is causing an error:


<body onload="MM_preloadImages('Light.jpg')" tracingopacity="50">

Apparently MM_preloadImages is undefined. Either define it or remove the call for it onload.

defyinggravity
02-08-2007, 01:10 PM
Thank you so much for the effort so far and for the tip on the MM_load. To be perfectly honest I am about 99.99993378564% code illiterate so this has been interesting to say the least.

I have tried both option you gave me, I even tried making 2 links at the bottom of the page home6.html to see if it wasn't the menus but no still joy. I am wondering if it is not supposed to happen in the script or am I just showing how clueless I am?

Or are there other possibilities? Quantum physics seems easier to understand than this...lol

jscheuer1
02-08-2007, 01:38 PM
You could try adding it here instead -

Replace:


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:


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.

defyinggravity
02-08-2007, 03:41 PM
John you are a scholar and a gentleman, it is working perfectly now...thank you for your amazing help!