If all of the fadeslideshows on the page either need this or have no links, then we can simplify things.
First, even without this, you don't need a separate script tag for each show. You need one external tag for jQuery, you already have that, and then one external tag for the main script, you have that. Then one internal script tag for all of the initializations plus one bit of added code at the end (which no longer needs the wrapperid selector) if you want to use the new window thing for the slideshows that have links:
Code:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="../files/fadeslideshow.js">
/***********************************************
* Ultimate Fade In Slideshow v2.0- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
***********************************************/
</script>
<script type="text/javascript">
var mygallery=new fadeSlideShow({
wrapperid: "fadeshow", //ID of blank DIV on page to house Slideshow
dimensions: [1000, 120], //width/height of gallery in pixels. Should reflect dimensions of largest image
imagearray: [
["../photos/headers/header1.jpg", "", "", ""],
["../photos/headers/header2.jpg", "", "", ""],
["../photos/headers/header3.jpg", "", "", ""],
["../photos/headers/header4.jpg", "", "", ""],
["../photos/headers/header5.jpg", "", "", ""],
["../photos/headers/header6.jpg", "", "", ""],
["../photos/headers/header7.jpg", "", "", ""] //<--no trailing comma after very last image element!
],
displaymode: {type:'auto', pause:2500, cycles:0, wraparound:false, randomize:true},
persist: false, //remember last viewed slide and recall within same session?
fadeduration: 1000, //transition duration (milliseconds)
descreveal: "ondemand",
togglerid: ""
})
var mygallery1=new fadeSlideShow({
wrapperid: "fadeshow1", //ID of blank DIV on page to house Slideshow
dimensions: [180, 200], //width/height of gallery in pixels. Should reflect dimensions of largest image
imagearray: [
["../photos/regions/chiltern1.jpg", "", "", ""],
["../photos/regions/chiltern2.jpg", "", "", ""],
["../photos/regions/chiltern3.jpg", "", "", ""],
["../photos/regions/chiltern4.jpg", "", "", ""],
["../photos/regions/chiltern5.jpg", "", "", ""],
["../photos/regions/chiltern6.jpg", "", "", ""],
["../photos/regions/chiltern7.jpg", "", "", ""] //<--no trailing comma after very last image element!
],
displaymode: {type:'auto', pause:2500, cycles:0, wraparound:false, randomize:true},
persist: false, //remember last viewed slide and recall within same session?
fadeduration: 1000, //transition duration (milliseconds)
descreveal: "ondemand",
togglerid: ""
})
var mygallery2=new fadeSlideShow({
wrapperid: "fadeshow2", //ID of blank DIV on page to house Slideshow
dimensions: [180, 200], //width/height of gallery in pixels. Should reflect dimensions of largest image
imagearray: [
["../photos/regions/chiltern_sm5.jpg", "../photos/regions/chiltern5.jpg", "_new", "This is Davids caravan"],
["../photos/regions/chiltern_sm6.jpg", "../photos/regions/chiltern6.jpg", "_new", "chiltern6.jpg"],
["../photos/regions/chiltern_sm7.jpg", "../photos/regions/chiltern7.jpg", "_new", "chiltern7.jpg"],
["../photos/regions/chiltern_sm8.jpg", "../photos/regions/chiltern8.jpg", "_new", "chiltern8.jpg"],
["../photos/regions/chiltern_sm9.jpg", "../photos/regions/chiltern9.jpg", "_new", "chiltern9.jpg"],
["../photos/regions/chiltern_sm10.jpg", "../photos/regions/chiltern10.jpg", "_new", "chiltern10.jpg"],
["../photos/regions/chiltern_sm11.jpg", "../photos/regions/chiltern11.jpg", "_new", "chiltern11.jpg"] //<--no trailing comma after very last image element!
],
displaymode: {type:'auto', pause:2500, cycles:0, wraparound:false, randomize:true},
persist: false, //remember last viewed slide and recall within same session?
fadeduration: 1000, //transition duration (milliseconds)
descreveal: "ondemand",
togglerid: ""
})
var mygallery3=new fadeSlideShow({
wrapperid: "fadeshow3", //ID of blank DIV on page to house Slideshow
dimensions: [180, 200], //width/height of gallery in pixels. Should reflect dimensions of largest image
imagearray: [
["../photos/headers/header1.jpg", "", "", ""],
["../photos/headers/header2.jpg", "", "", ""],
["../photos/headers/header3.jpg", "", "", ""],
["../photos/headers/header4.jpg", "", "", ""],
["../photos/headers/header5.jpg", "", "", ""],
["../photos/headers/header6.jpg", "", "", ""],
["../photos/headers/header7.jpg", "", "", ""] //<--no trailing comma after very last image element!
],
displaymode: {type:'auto', pause:2500, cycles:0, wraparound:false, randomize:true},
persist: false, //remember last viewed slide and recall within same session?
fadeduration: 1000, //transition duration (milliseconds)
descreveal: "ondemand",
togglerid: ""
})
var mygallery4=new fadeSlideShow({
wrapperid: "fadeshow4", //ID of blank DIV on page to house Slideshow
dimensions: [180, 200], //width/height of gallery in pixels. Should reflect dimensions of largest image
imagearray: [
["../photos/regions/chiltern_sm5.jpg", "../photos/regions/chiltern5.jpg", "_new", "This is Davids caravan"],
["../photos/regions/chiltern_sm6.jpg", "../photos/regions/chiltern6.jpg", "_new", "chiltern6.jpg"],
["../photos/regions/chiltern_sm7.jpg", "../photos/regions/chiltern7.jpg", "_new", "chiltern7.jpg"],
["../photos/regions/chiltern_sm8.jpg", "../photos/regions/chiltern8.jpg", "_new", "chiltern8.jpg"],
["../photos/regions/chiltern_sm9.jpg", "../photos/regions/chiltern9.jpg", "_new", "chiltern9.jpg"],
["../photos/regions/chiltern_sm10.jpg", "../photos/regions/chiltern10.jpg", "_new", "chiltern10.jpg"],
["../photos/regions/chiltern_sm11.jpg", "../photos/regions/chiltern11.jpg", "_new", "chiltern11.jpg"] //<--no trailing comma after very last image element!
],
displaymode: {type:'auto', pause:2500, cycles:0, wraparound:false, randomize:true},
persist: false, //remember last viewed slide and recall within same session?
fadeduration: 1000, //transition duration (milliseconds)
descreveal: "ondemand",
togglerid: ""
})
jQuery(function($){ //author's note: this function is wrong, now corrected in the original and in a later post - jscheuer1
$(.gallerylayer a').click(function(e){
try{$.fn.mynewwin.close();}catch(e){}
$.fn.mynewwin = window.open(this.href, this.target, 'width=640, height=480');
e.preventDefault();
});
});
</script>
Bookmarks