Found this great article on using jquery for image swapping:
http://jquery-howto.blogspot.com/2009/05/replacing-images-at-time-intervals.html
How do you suggest I hyperlink the images?
Found this great article on using jquery for image swapping:
http://jquery-howto.blogspot.com/2009/05/replacing-images-at-time-intervals.html
How do you suggest I hyperlink the images?
Learn how jquery works and fix it! Or use a plugin such as the cycle plugin - this still requires some knowledge of jquery.
Untested but it should work...
function swapImages(tag){
var element = tag||'img';
var $active = $('#myGallery '+tag+'.active');
var $next = ($('#myGallery '+tag+'.active').next().length > 0) ? $('#myGallery '+tag+'.active').next() : $('#myGallery '+tag+':first');
$active.fadeOut(function(){
$active.removeClass('active');
$next.fadeIn().addClass('active');
});
}
setInterval(function(){swapImages('a');}, 5000);
// or the original usage with no links on the images
setInterval(swapImages, 5000);
Just keep in mind whatever you provide as tag
will get the class active
so adjsut the css as nessecary.
Anyhow, this is really simple - i would also suggest doing some tutorials or reading the documentation for jQuery. You should be able to parse this script as you read it - its pretty simple :-)
Solved it:
function swapImages() {
var $active = $('#myGallery a:has(img) > img.active');
var $next = ($('#myGallery a:has(img.active)').next().find('img').length > 0) ? $('#myGallery a:has(img.active)').next().find('img') : $('#myGallery a:has(img):first > img');
$active.fadeOut(function() {
$active.removeClass('active');
$next.fadeIn().addClass('active');
});
}