
Originally Posted by
jscheuer1
although the style switching code sets a cookie and remembers which stylesheet to activate on reload, nothing is done to remember which image to show
Could there be a cookie for which image to show?
And ive added the code to my site, but nothing works. I have the fade slideshow from DD on my page and jquery 1.3.2 on my page, do you think there's a conflict between them and the image changer?
Code:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://www.kelvinluck.com/assets/jquery/styleswitch/stylesheetToggle.js"></script>
<script type="text/javascript" src="fadeslideshow.js"></script>
<script type="text/javascript">
var mygallery=new fadeSlideShow({
wrapperid: "fadeshow1",
dimensions: [740, 300],
imagearray: [
["images/electronics.jpg", "", "", ""],
["images/19_5_orig.jpg"],
["images/chips_3_bg_102602.jpg", "", "", ""]
],
displaymode: {type:'auto', pause:3000, cycles:0, wraparound:false},
persist: false, //remember last viewed slide and recall within same session?
fadeduration: 2000, //transition duration (milliseconds)
descreveal: "ondemand",
togglerid: ""})
</script>
<script type="text/javascript">
$(function()
{
var imageURL = "off.png";
if (document.images) {
var on = new Image();
on.src = "on.png";
var off = new Image();
off.src = "off.png";
}
function changeImage() {
if (document.images) {
if (imageURL == "off.png") imageURL = "on.png";
else imageURL = "off.png";
document.images.myImage.src = imageURL;
createCookie('imageURL', imageURL, 365);
}
}
if(readCookie('imageURL') === 'on.png'){
changeImage();
}
// Call stylesheet init so that all stylesheet changing functions
// will work.
$.stylesheetInit();
// This code loops through the stylesheets when you click the link with
// an ID of "toggler" below.
$('#toggler').bind(
'click',
function(e)
{
$.stylesheetToggle();
changeImage();
return false;
}
);
// When one of the styleswitch links is clicked then switch the stylesheet to
// the one matching the value of that links rel attribute.
$('.styleswitch').bind(
'click',
function(e)
{
$.stylesheetSwitch(this.getAttribute('rel'));
return false;
}
);
}
);
</script>
Bookmarks