功能测试
首页 > 网站技术 > 正文

JS 图片切换效果

发布-learlon | 查看- | 发表时间-2009-4-21

<style type="text/css">
#play img {border:0px}
#play {width:1013px;height:78px;overflow:hidden;margin: 0 auto; border: 0px solid #fff; padding:0px;}
#play_bg {position:absolute;background-color:#000;margin-top:0px;height:78px;width:1013px;filter: Alpha(Opacity=30);opacity:0.3;z-index:1000}
#play_text {position:absolute;margin:58px 0 0 900px;height:50px;width:60px;z-index:1002}
#play_text ul {list-style-type:none; width:60px;height:50px;display:block;padding-top:1px;_padding-top:0px;filter: Alpha(Opacity=80);opacity:0.8;}
#play_text ul li {width:14px;height:14px;float:left;background-color:#000;display:block;color:#FFF;text-align:center;margin:1px;cursor:pointer;font-family:"微软雅黑"; font-size:9px;}
#play_list a{display:block;width:1004px;height:78px;position:absolute;overflow:hidden}
</style>

<div id="play">   
    <div id="play_bg"></div>
    <div id="play_text">
        <ul>
            <li>1</li>
            <li>2</li>
            <li>3</li>
           
        </ul>
    </div>
    <div id="play_list">
    <a href="#" target="_blank">
        <img src="images/j01.jpg" title="" alt="" border="0" />
    </a>
    <a href="#" target="_blank">
        <img src="images/j02.jpg" title="" alt="" border="0" />
    </a>
    <a href="#" target="_blank">
        <img src="images/j03.jpg" title="" alt="" border="0" />
    </a>
    </div>
</div>
<script type="text/javascript">
var t = n = 0, count = $("#play_list a").size();
$(function(){   
    $("#play_list a:not(:first-child)").hide();
   
    $("#play_text li:first-child").css({"background":"#fff",'color':'#000'});
   
    $("#play_text li").click(function() {
        var i = $(this).text() - 1;
        n = i;
        if (i >= count) return;
       
       
        $("#play_list a").filter(":visible").fadeOut(500).parent().children().eq(i).fadeIn(1000);
        $(this).css({"background":"#fff",'color':'#000'}).siblings().css({"background":"#000",'color':'#fff'});
    });
    t = setInterval("showAuto()", 6000);
    $("#play").hover(function(){clearInterval(t)}, function(){t = setInterval("showAuto()", 6000);});
})

function showAuto()
{
    n = n >= (count - 1) ? 0 : ++n;
    $("#play_text li").eq(n).trigger('click');
}
</script>

效果图:

或许你还对下面的文章感兴趣

EN:Learlon
QQ:9907004
MSN:learlon@hotmail.com
Email:learlon@163.com
喜欢蓝色,因为它不艳丽也不惨淡;喜欢大海,是因为它宽广,时而风起浪卷,时而静若止水;喜欢听钢琴曲,是因为它悠闲、恬静。喜欢[在路上]这个名字,是因为离成功的彼岸还很远,还要努力奋斗。

最新文章
最近评论
访客留言
Copyright © 21per.com. Some Rights Reserved. 闽ICP备09005024号 
返回顶部