I am New to JQuery, just started to play with it, and i have a image selector which is working great, however i am trying to turn it in to a slideshow, so it swaps the images and text every few seconds but i still want to keep the click functions on separate elements.
Can anyone Help?:
$ ( function () {
$ ("a:has(img.gallery)").click(function() {
var largePath = $ (this) .attr ("href");
var caption = $ (this) . attr ("title");
var image = $ ("#large-image");
image.fadeOut('400', function () {
image.attr ({ src: largePath }) ;
image.fadeIn('400');
});
$ ("#caption1"). text (caption) ;
return false;
}) ;
});
</script>
Any and all help will be开发者_开发技巧 most appreciated
thanks
jquery timers plugin is quite useful, but you can always use the javascript setInterval or setTimeout functions. You should create an array of the images you want to use and cycle through them with the timers plugin or setInterval function.
精彩评论