/    Sign up×
Community /Pin to ProfileBookmark

How do i make my images fade between slides?

I have this perfect slideshow set up thanks to Toicontien. I was wondering if anyone could help me fade the images between slides. Is something that can be done with my code? Thanks for your time.

interval : 3,
timer : null,

addImage : function(src)
{
return this.images.push( this.createImage(src) ) – 1;
},

change : function()
{
this.currentImage = this.getNextImage();
this.getImage().src = this.images[ this.currentImage ].src;
},

createImage : function(src)
{
var img = document.createElement(“img”);
img.src = src;
return img;
},

destroy : function()
{
this.stop();
this.images = null;
},

getImage : function()
{
return document.getElementById(this.id);
},

getNextImage : function()
{
var i = this.currentImage + 1;

if (i == this.images.length) {
i = 0;
}

return i;

},

start : function()
{
if (this.timer) {
return;
}
this.timer = setInterval(this.change.bind(this), this.interval * 1000);
},

stop : function()
{
if (!this.timer) {
return;
}
clearInterval(this.timer);
this.timer = null;
}

};

<script type=”text/javascript”>
<!–
var img = new ImageSwitcher(“logos_slide”);
img.addImage(“images/logos_slide.jpg”);
img.addImage(“images/logos_slide2.jpg”);
img.start();
// –>
</script>

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@bradleybebadauthorJan 24.2009 — Is it possible with this code or do I need to take a different approach?
Copy linkTweet thisAlerts:
@felgallJan 25.2009 — See http://www.brothercake.com/site/resources/scripts/transitions/ for how to set up various image transitions with JavaScript.
Copy linkTweet thisAlerts:
@wbportJan 26.2009 — You might want to check out an earlier thread: panning slideshow script.
Copy linkTweet thisAlerts:
@bradleybebadauthorJan 26.2009 — Says it only works for FF :[
Copy linkTweet thisAlerts:
@bluestartechJan 26.2009 — thanks for the link felgall
Copy linkTweet thisAlerts:
@bradleybebadauthorJan 26.2009 — Woops, didnt even see felgalls link
Copy linkTweet thisAlerts:
@bradleybebadauthorJan 26.2009 — That works great!!! THANKS
×

Success!

Help @bradleybebad spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...