PDA

View Full Version : Ultimate FadeIn Slideshow issue on ASP page(s)



bszopi
06-06-2011, 06:20 PM
1) Script Title: Ultimate Fade-In Slideshow v2.4

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm

3) Describe problem: can't load multiple slideshows on different ASP pages

I have a generic ASP page as a template, which then loads different pages into the template. I am able to run 1 instance of the slideshow on any page, but when I try to run a second instance on a different page, it doesn't work. If the slideshows are both on the same page, then they both work. Using Firebug, I have found the following error on the 2nd page from within the javascript:



$curimage.get(0) is undefined
[Break On This Error] if ($curimage.get(0).complete){ //accounf for IE not firing image.onload

Since the ASP page is just a template, both instances are loaded into the same HEAD. On the second page, if I rename the DIV to the ID of the first slideshow, it works just fine.

Any thoughts on how I can get this to work? I'm typically a PHP coder, but have been asked to help out on this project, so I am learning ASP as I go. Thanks!

Here is a link to the page if needed for troubleshooting:

www.bgark.com/testdefault.asp

Slideshow 1 is on the Home page, and Slideshow 2 is on the Projects page.

jscheuer1
06-06-2011, 06:57 PM
I see you've modified the fadeslideshow.js script here:


jQuery(document).ready(function($){ //fire on DOM ready
var setting=slideshow.setting
var fullhtml=fadeSlideShow.routines.getFullHTML(setting.imagearray) //get full HTML of entire slideshow
setting.$wrapperdiv=$('#'+setting.wrapperid).css({position:'relative', visibility:'visible', background:'black', overflow:'hidden', width:setting.dimensions[0], height:setting.dimensions[1]}).empty() //main slideshow DIV
// if (setting.$wrapperdiv.length==0){ //if no wrapper DIV found
// alert("Error: DIV with ID \""+setting.wrapperid+"\" not found on page.")
// return
// }

What that does is allow it to continue on initializing even when the markup for the show is not there. That's what causes the error.

I'm pretty sure you did that to avoid the alert because you found it too difficult to only initialize only the slideshow, if any on any particular page. This often happens with server side includes/templates as one can have with asp, PHP, or any of the various others.

If you instead make it like so:


jQuery(document).ready(function($){ //fire on DOM ready
var setting=slideshow.setting
var fullhtml=fadeSlideShow.routines.getFullHTML(setting.imagearray) //get full HTML of entire slideshow
setting.$wrapperdiv=$('#'+setting.wrapperid).css({position:'relative', visibility:'visible', background:'black', overflow:'hidden', width:setting.dimensions[0], height:setting.dimensions[1]}).empty() //main slideshow DIV
if (setting.$wrapperdiv.length==0){ //if no wrapper DIV found
// alert("Error: DIV with ID \""+setting.wrapperid+"\" not found on page.")
return
}

leaving the rest of that section intact, it will still avoid the alert. But it will also exit (return) without trying to continue. This has been the solution in many similar cases.

It may or may not be the only problem, but it has to be fixed first.

Make sure to upload the changes, clear the cache and refresh the pages before gaging the results.

bszopi
06-06-2011, 07:06 PM
If you instead make it like so:


jQuery(document).ready(function($){ //fire on DOM ready
var setting=slideshow.setting
var fullhtml=fadeSlideShow.routines.getFullHTML(setting.imagearray) //get full HTML of entire slideshow
setting.$wrapperdiv=$('#'+setting.wrapperid).css({position:'relative', visibility:'visible', background:'black', overflow:'hidden', width:setting.dimensions[0], height:setting.dimensions[1]}).empty() //main slideshow DIV
if (setting.$wrapperdiv.length==0){ //if no wrapper DIV found
// alert("Error: DIV with ID \""+setting.wrapperid+"\" not found on page.")
return
}

leaving the rest of that section intact, it will still avoid the alert. But it will also exit (return) without trying to continue. This has been the solution in many similar cases.


That worked perfectly. Thanks! I should have thought to check out the js more closely...