A frequent request here seems to be for an easy to use slideshow. Here's one with minimal code and no bells and whistles.
Note that there is no provision to pause on hover.
The only parameter you might want to tweak is the display time.
Look for this code:
Code:
$(function() {
setInterval( "slideSwitch()", 5400 );
});
The slide interval is set to 5400 milliseconds (5.4 seconds).
Note that you can add ALT text and a title, which can help with SEO.
Also, since the file names are in the <body> of the page the file names can also potentially enhance SEO.
This slideshow works with jQuery from version 1.4.2 and up.
The slideshow works fine with XSite Pro.
YOU WILL NEED TO UPDATE THE DOCTYPE. XSitePro's older DOCTYPE is inadequate for jQuery.
In
Other -->
Global Scripts -->
Before anything else in the fileCode:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
The following scripts go in the <HEAD> section of the page.
Other -->
Global Scripts -->
In the HEAD section of the page...Code:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script type="text/javascript">
function slideSwitch() {
var $active = $('#slideshow IMG.active');
if ( $active.length == 0 ) $active = $('#slideshow IMG:last');
// use this to pull the images in the order they appear in the markup
var $next = $active.next().length ? $active.next()
: $('#slideshow IMG:first');
// uncomment the 3 lines below to pull the images in random order
// var $sibs = $active.siblings();
// var rndNum = Math.floor(Math.random() * $sibs.length );
// var $next = $( $sibs[ rndNum ] );
$active.addClass('last-active');
$next.css({opacity: 0.0})
.addClass('active')
.animate({opacity: 1.0}, 1000, function() {
$active.removeClass('active last-active');
});
}
$(function() {
setInterval( "slideSwitch()", 5400 );
});
</script>
<!---- That's the Java Script. Here's the CSS ---->
<style type="text/css">
/*** set the width and height to match your images **/
#slideshow {
position:relative;
width:600px;
height:400px;
}
#slideshow IMG {
position:absolute;
top:0;
left:0;
z-index:8;
opacity:0.0;
}
#slideshow IMG.active {
z-index:10;
opacity:1.0;
}
#slideshow IMG.last-active {
z-index:9;
}
</style>
This code goes in the table cell <td> where you want the slideshow.
Code:
<td style=
"WIDTH: 610px; HEIGHT: 410px;"
valign="middle"
align="center">
<div id="slideshow">
<img src="/images/falcon-inflight-01.jpg" title="Falcon Picture 1" alt="keywords and phrases 1" />
<img src="/images/falcon-inflight-02.jpg" title="Falcon Picture 2" alt="keywords and phrases 2"/>
<img src="/images/falcon-inflight-03.jpg" title="Falcon Picture 3" alt="keywords and phrases 3"/>
</div>
</td>
Enjoy!