View Full Version : Flaw in Dynamic Ajax display script causing slideshow to break

08-20-2007, 05:37 PM
Hi all.

I'm a little saddened by this because I have created an entire page for a non-profit organization around this script and 2 weeks before I am set to go back to school i find out that a main feature (a really wicked slide show (http://www.projectseven.com/products/galleries/ssm/ssm_03.htm) which cost them 100$ on my recommendation) appears to be incompatible with this script in it's current state.

The script is the Dynamic Ajax Content (http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm) script from DynamicDrive.

What occurs is that the slide show works the first time it is visited, however if the user navigates to another link on the page and then decides to re-visit the slide show... it does not function at all. The issue, as it has been described to me by the writers of the slide show, is:

The entire issue is that the paradigm is flawed, since the [Ajax] toggler simply copies the html markup, and does not address any dom-related objects that
may have been instantiated by the scripts on the page that was loaded in,
the [Ajax] toggler must never re-copy. Unlike a frames-based page, or even an iframe, the new page is not under it's own DOM, it is acting on and getting
data from the same original parent page all of the time. This means hat the
DOM and related objects can, and will, become corrupt. Since the [Ajax] toggler
simply copies the raw markup into the div, none of the DOM-related objects
are removed when toggling takes place, so in essence, when the toggler
copies the markup a second time the now new SSM system is attempting to deal
with an already DOM initialized slide show whose parameters are still that
of the previous slide show.

Jay, this technique is an exercise in futility,
it will never work correctly... the toggler can never re-copy an SSM system,
however, since the toggler is working with only one content div, when you
toggle to other content the SSM markup has been removed from the page, but
when re-copied it will not work correctly because the DOM objects from the
previous SSM are still in the pages DOM, causing the new SSM to not work
correctly because it cannot be re-initialized.

The last part of the explanation has me somewhat hopeful.

The script has a built-in function that, for efficiency, checks if the scripts being loaded with the page (via loadobjs()) have already been loaded... and if so does not re-download them. I was hoping that this could be modified to accept a variable (such as 'reload()' ) that would force the ajax script to completely re-initialize / clear & re-download the content being loaded. Would this work?

for ex:

<img name="YPPButton" src="images/logoButtons/YPP_BW.gif" onclick="loadobjs('css/ypp.css','p7ssm/p7ssm_01.css'); ajaxpage('YPP.htm', 'contentarea'); reload()">

You can see the problem in action by following these steps:

go to www.enviromark.ca/head/index.htm
Press the 2nd vertical B&W button (called Young Parents Program), then "Slide Show"
then click one of the other vertical buttons (to load a new page via the Ajax script)
and then go back to where the slide show is (2nd button --> slideshow).

the controls / thumb panel no longer work and the slide show is stopped

The ajax script is here www.enviromark.ca/head/js/DynamicAjaxContent.js or here http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm (has explanations).

Sorry for the long post... I just really needed to be thorough to make sure that if there was any possibility of fixing this it was addressed.

Thanks a lot :o

08-20-2007, 06:54 PM
Also, if this script really is fatally flawed... any suggestions on achieving the same effect would be greatly appreciated. I am quite fond of the seamless loading of the page

08-21-2007, 12:49 AM
Have you used FF and Firebug to try to see where the scripts are failing.
Using you steps , FF gives the error

df has no properties -- p7SSMscripts.js -- line 343
You can produce errors doing other things.
If you navigate to the slideshow and open it, then select Info and look at a sub menus contents, then go back to the slideshow you get various errors. Looks like most of them are in BorderFade.js. You can get a little empty square with the black border, or a thin long vertical border, which may or may not grow to around an image that may or may not be there.
Sometimes the border will grow to the right and extend off screen.
In IE you usually end up with one thumbnail image.

08-22-2007, 06:13 PM
Hey Rwedge,

I have been trying to migrate the page to using server-side includes instead of the ajax script, so for now i'm going to abandon this thread... however if I can't get that working I will come back.

I have not yet used firebug but will definitely install it now. Thanks a lot for the tip :)