PDA

View Full Version : Dynamic Ajax Content + imageslide-plugin



mlarino
12-11-2007, 10:43 AM
1) Script Title: Dynamic Ajax Content

2) Script URL (on DD):

http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm
http://www.gcmingati.net/wordpress/wp-content/lab/jquery/imagestrip/imageslide-plugin.html

3) Describe problem:
Hi I am trying to design my portfolio site, and found this script to load external content. I didnt want to use iframes to load my images, but now that I started using it I found a big problem.
I am using the "dynamic Ajax Content script" to load external html with JS and CSS. the first link I clic loads fine, but when i try to clic on another link to open another html with js and css, the script stops working and doesnt load anything else.
www.mlarino.com/web2 (clic on WORK and you will see the portfolio with the scripts in action)
Can someone help me putting together this two scrips?
Thanks

jscheuer1
12-12-2007, 04:53 PM
Your page is in violation of Dynamic Drive's usage terms (http://www.dynamicdrive.com/notice.htm), which, among other things, state that the script credit must appear in the source code of the page(s) using the script. Please reinstate the notice first.

It doesn't work even the first time in some browsers. The loadobjs method of the Ajax script is simply intended to make scripts and style available to the 'top' page. With style, just being available (as long as there are no other conflicting styles) activates it. With scripts though, often a command is required to activate/initialize. In any case, loadobjs only loads once anyway. Once the script or style is associated with the top page, it is already there. The loadobjs function keeps track of this and will not load it again.

The activation of a script against imported content cannot be done until after the browser has parsed the imported content.

There are various ways generally. If you are going to use mygalone as the id for all externally loaded galleries, we can:

First forget about loadobjs. Put all the scripts and styles it is loading directly on the top page as if the gallery were already there (loadobjs would only be putting them on there once anyway), except the one that initializes mygalone (slide.js).

Create a new script - say, call it prepgal.js:



function killGal(){
if(document.getElementById('mygalone'))
document.getElementById('mygalone').id='';
}

function pollGal(){
if(document.getElementById('mygalone'))
$("div#mygalone").slideView()
else
setTimeout('pollGal()', 300);
}

and link it to the top page:


<script type="text/javascript" src="prepgal.js"></script>

or similar using the actual path and filename of this new script.

Now, where you had:


<a href="javascript:ajaxpage('http://www.mlarino.com/web2/textpattern/ajaxfiles/external2.htm', 'rightcolumn'); loadobjs('http://www.mlarino.com/web2/textpattern/ajaxfiles/slide.css', 'http://www.mlarino.com/web2/textpattern/ajaxfiles/jquery-1.2.1.pack.js', 'http://www.mlarino.com/web2/textpattern/ajaxfiles/jquery.easing.1.3.js', 'http://www.mlarino.com/web2/textpattern/ajaxfiles/jquery.slideviewer.1.1.js', 'http://www.mlarino.com/web2/textpattern/ajaxfiles/slide.js')">test</a>

You can now use:


<a href="javascript:killGal();ajaxpage('http://www.mlarino.com/web2/textpattern/ajaxfiles/external2.htm', 'rightcolumn');pollGal();">test</a>