首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

一个容易的jQuery Slideshow效果 (转)

2012-08-31 
一个简单的jQuery Slideshow效果 (转)下面是一个jQuery Slideshow效果,用了一种很不错的思路。请看代码:?d

一个简单的jQuery Slideshow效果 (转)

下面是一个jQuery Slideshow效果,用了一种很不错的思路。请看代码:

?

<div id="slideshow">    <img src="img/img1.jpg" alt="一个容易的jQuery Slideshow效果 (转)" />    <img src="img/img2.jpg" alt="一个容易的jQuery Slideshow效果 (转)" />    <img src="img/img3.jpg" alt="一个容易的jQuery Slideshow效果 (转)" /></div>

?

#slideshow {    position:relative;    height:350px;}#slideshow IMG {    position:absolute;    top:0;    left:0;    z-index:8;}#slideshow IMG.active {    z-index:10;}#slideshow IMG.last-active {    z-index:9;}
?

?

?

function slideSwitch() {    var $active = $('#slideshow IMG.active');    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');    var $next =  $active.next().length ? $active.next()        : $('#slideshow IMG:first');    $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()", 5000 );});

?

大家细细品味吧。

?

原文地址:http://jonraasch.com/blog/a-simple-jquery-slideshow

热点排行