带编号图片幻灯片自动切换缓冲效果

3个月前 (02-22 13:56)阅读60回复0
大陆
大陆
  • 管理员
  • 发消息
  • 注册排名1
  • 经验值4189
  • 级别管理员
  • 主题837
  • 回复2
楼主

js幻灯片自动播放特效代码,图片切换时带缓冲显示效果,并幻灯片右下角显示图片编号。

<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>带编号图片幻灯片自动切换缓冲效果_武鸣人</title>
<meta name="keywords" content="武鸣人网站,武鸣信息网,武鸣本地网,武鸣信息资源平台,减肥,健身,励志,励志语录,js特效,网页特效,www.wuming.ren">
<meta name="description" content="欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。">
<style> 
body,div,ul,li{margin:0;padding:0;}
ul{list-style-type:none;}
body{background:#000;text-align:center;font:12px/20px Arial;}
#box_www_wuming_ren{position:relative;width:492px;height:172px;background:#fff;border-radius:5px;border:8px solid #fff;margin:10px auto;cursor:pointer;}
#box_www_wuming_ren .list{position:relative;width:490px;height:170px;overflow:hidden;}
#box_www_wuming_ren .list ul{position:absolute;top:0;left:0;}
#box_www_wuming_ren .list li{width:490px;height:170px;overflow:hidden;}
#box_www_wuming_ren .count{position:absolute;right:0;bottom:5px;}
#box_www_wuming_ren .count li{color:#fff;float:left;width:20px;height:20px;cursor:pointer;margin-right:5px;overflow:hidden;background:#F90;opacity:0.7;filter:alpha(opacity=70);border-radius:20px;}
#box_www_wuming_ren .count li.current{color:#fff;opacity:1;filter:alpha(opacity=100);font-weight:700;background:#f60;}
#tmp{width:100px;height:100px;background:red;position:absolute;}
</style>
<script type="text/javascript"> 
window.onload = function ()
{//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
var oBox = document.getElementById("box_www_wuming_ren");
var oList = oBox.getElementsByTagName("ul")[0];
var aImg = oBox.getElementsByTagName("img");
var timer = playTimer = null;
var index = i = 0;
var bOrder = true;
var aTmp = [];
var aBtn = null;
//生成数字按钮
for (i = 0; i < aImg.length; i++) aTmp.push("<li>" + (i + 1) + "</li>");
//插入元素
var oCount = document.createElement("ul");
oCount.className = "count";
oCount.innerHTML = aTmp.join("");
oBox.appendChild(oCount);
aBtn = oBox.getElementsByTagName("ul")[1].getElementsByTagName("li");
//初始化状态
cutover();
//按钮点击切换
for (i = 0; i < aBtn.length; i++)
{
aBtn[i].index = i;
aBtn[i].onmouseover = function ()
{
index = this.index;
cutover()
}
}
function cutover()
{
for (i = 0; i < aBtn.length; i++) aBtn[i].className = "";
aBtn[index].className = "current";
startMove(-(index * aImg[0].offsetHeight))
}
//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
function next()
{
bOrder ? index++ : index--;
index <= 0 && (index = 0, bOrder = true);
index >= aBtn.length - 1 && (index = aBtn.length - 1, bOrder = false)
cutover()
}
playTimer = setInterval(next, 3000);
//鼠标移入展示区停止自动播放
oBox.onmouseover = function ()
{
clearInterval(playTimer)
};
//鼠标离开展示区开始自动播放
oBox.onmouseout = function ()
{
playTimer = setInterval(next, 3000)
};
function startMove(iTarget)
{
clearInterval(timer);
timer = setInterval(function ()
{
doMove(iTarget)
}, 30)
}
function doMove (iTarget)
{
var iSpeed = (iTarget - oList.offsetTop) / 10;
iSpeed = iSpeed > 0 ? Math.ceil(iSpeed) : Math.floor(iSpeed);
oList.offsetTop == iTarget ? clearInterval(timer) : oList.style.top = oList.offsetTop + iSpeed + "px"
}
};//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
</script>
</head>
<body>
<a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr>
<!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。-->
<script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script>
<script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script>
<div id="box_www_wuming_ren">
    <div class="list">
        <ul>
            <li><img src="/img/20240222_www_wuming_ren_9.jpg" width="490" height="170" /></li>
            <li><img src="/img/20240222_www_wuming_ren_10.jpg" width="490" height="170" /></li>
            <li><img src="/img/20240222_www_wuming_ren_11.jpg" width="490" height="170" /></li>
            <li><img src="/img/20240222_www_wuming_ren_12.jpg" width="490" height="170" /></li>
            <li><img src="/img/20240222_www_wuming_ren_13.jpg" width="490" height="170" /></li>
        </ul>
    </div>
</div>
</body>
</html>


0
0
收藏0
回帖

带编号图片幻灯片自动切换缓冲效果 期待您的回复!

取消
载入表情清单……
载入颜色清单……
插入网络图片

取消确定

图片上传中
编辑器信息
提示信息