PDA

View Full Version : gAjax pausing script scroller guidance



steadwell
07-21-2010, 04:39 PM
1) Script Title: gAjax pausing script scroller

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex18/gajaxpausescroller.htm

3) Describe problem: The script works fine in my news.php module stand alone, however, when it gets loaded from my index.php when selected from the menu, the scrolling functionality is not there. I'm fairly sure it has to do with the timing of loading events. Any input would be appreciated.

ddadmin
07-21-2010, 07:22 PM
Please post a link to the page on your site that contains the problematic script so we can check it out.

steadwell
07-22-2010, 11:55 AM
My site is located at http://stephendowell.net. Index.php loads /portal/news.php when selected from the menu. The loaded module contains it's own scripts which seem to work fine stand alone, however, doesn't function when loaded from the index.php module.

Thanks for any input and let me know what else I can provide to help.

ddadmin
07-22-2010, 10:10 PM
The problem is due to the fact that you're loading "news.php" using Ajax. Pages fetched via Ajax should they contain JavaScripts within it in many cases won't run correctly when brought over this way. Ajax basically copies the contents of the external file similar to copying plain text and just dumps it onto the main page. Browsers don't know to interpret scripts or even CSS (in IE) within that copied content.

A workaround you can try is to use an IFRAME to show "news.php" instead. Try creating a blank page with just an IFRAME tag, ie:


<iframe src="http://stephendowell.net/portal/news.php" style="width:100%;height:400px"></iframe>

and save it as say "newscontainer.php". Then, change the href attribute of the news link to point to this page instead, which when called will insert the IFRAME onto your main page, in turn displaying "news.php". Untested, but should work.

steadwell
07-23-2010, 11:35 AM
Your suggestion has given me some ideas about alternative approaches. When I tried your advice as stated, the script functions fine but it displays only the referenced module (newscontainer.php) in a new window instead of displaying the news page within the index page. I appreciate your feedback and will continue tinkering with this. Also, any other ideas are surely welcome.
Thanks!

steadwell
07-23-2010, 02:02 PM
Thanks to your suggestion, I've got this working pretty well.

Thanks For Your Input!