打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
jQuery 图片切换,带标题和说明文字
<html>
<head>
<title>图片切换,带标题文字</title>
<script type="text/javascript" src="/ajaxjs/jquery1.3.2.js"></script>
<style type="text/css">
body,h1,h2,h3,h4,h5,h6,p,ul,li,dl,dt,dd{padding:0;margin:0;font-size:12px;font-family:Arial,Verdana, Helvetica, sans-serif;word-break:break-all;word-wrap:break-word;}
li{list-style:none;}img{border:none;}em{font-style:normal;}
a{color:#555;text-decoration:none;outline:none;blr:this.onFocus=this.blur();}
a:hover{color:#000;text-decoration:underline;}
.clear{height:0;overflow:hidden;clear:both;}
.play{width:500px;height:230px;border:#ccc 1px solid; text-align:left; margin:30px;}
.textbg{margin-top:200px;z-index:1;filter:alpha(opacity=40);opacity:0.4;width:500px;position:absolute;height:30px;background:#000;}
.text{margin-top:200px;z-index:2;padding-left:10px;font-size:14px;font-weight:bold;width:340px;color:#fff;line-height:30px; overflow:hidden;position:absolute;cursor:pointer;}
.num{margin:205px 5px 0 350px;z-index:3;width:145px; text-align:right;position:absolute;height:25px;}
.num a{margin:0 2px;width:20px;height:20px;font-size:14px; font-weight:bold;line-height:20px;cursor:pointer;color:#000;padding:0 5px;background:#D7D6D7;text-align:center}
.num a.on{background:#FFD116;color:#A8471C;}
.num a.on2{background:#D7D6D7;color:#000;}
.content img{width:500px;height:230px;}
</style>
</head>
<body>
<div class="play">
 <ul>
        <li class="textbg"></li>
        <li class="text"></li>
        <li class="num"><a>1</a><a>2</a><a>3</a><a>4</a><a>5</a><a>6</a></li>
        <li class="content">
            <a href="#" target="_blank"><img src="/jscss/demoimg/wall1.jpg" alt="澳大利亚:体验蓝山风光,感受澳洲风情" /></a>
            <a href="#" target="_blank"><img src="/jscss/demoimg/wall2.jpg" alt="九月抄底旅游,马上行动" /></a>
            <a href="#" target="_blank"><img src="/jscss/demoimg/wall3.jpg" alt="港澳旅游:超值特价,奢华享受" /></a>
            <a href="#" target="_blank"><img src="/jscss/demoimg/wall4.jpg" alt="炎炎夏日哪里去,途牛带你海滨游" /></a>
            <a href="#" target="_blank"><img src="/jscss/demoimg/wall5.jpg" alt="定途牛旅游线路,优惠购买乐相册" /></a>
            <a href="#" target="_blank"><img src="/jscss/demoimg/wall3.jpg" alt="三亚自助游" /></a>
        </li>
    </ul>
</div>
<script type=text/javascript>
var t = n = 0, count = $(".content a").size();
$(function(){
 var play = ".play";
 var playText = ".play .text";
 var playNum = ".play .num a";
 var playConcent = ".play .content a";
 
 $(playConcent + ":not(:first)").hide();
 $(playText).html($(playConcent + ":first").find("img").attr("alt"));
 $(playNum + ":first").addClass("on");
 $(playText).click(function(){window.open($(playConcent + ":first").attr('href'), "_blank")});
 $(playNum).click(function() {
    var i = $(this).text() - 1;
    n = i;
    if (i >= count) return;
    $(playText).html($(playConcent).eq(i).find("img").attr('alt'));
    $(playText).unbind().click(function(){window.open($(playConcent).eq(i).attr('href'), "_blank")})
    $(playConcent).filter(":visible").hide().parent().children().eq(i).fadeIn(1200);
    $(this).removeClass("on").siblings().removeClass("on");
    $(this).removeClass("on2").siblings().removeClass("on2");
    $(this).addClass("on").siblings().addClass("on2");
 });
 t = setInterval("showAuto()", 5000);
 $(play).hover(function(){clearInterval(t)}, function(){t = setInterval("showAuto()", 5000);});
})
function showAuto(){
 n = n >= (count - 1) ? 0 : ++n;
 $(".num a").eq(n).trigger('click');
}
</script>
</body>
</html>
 
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
jQuery炫酷翻页图片相册
清爽简洁的图片交替导航效果lya
鼠标移上图片,变换出大图片
动态菜单(一)
Jquery实现图片左右滚动(自动)
纯CSS酷黑风格三级下拉菜单代码
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服