JS幻灯片可循环播放可平滑旋转带滚动导航(自写)

时间:2021-05-26

最近在帮别人改一些东西,在网上找了好久,但是没有相同的,自己改了下,拿出来分享下:
先展示下效果把:

index.html 页面展示代码
复制代码 代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://putedStyle(oElement, null)[attr]
}
else if (arguments.length == 3)
{
switch (attr)
{
case "width":
case "height":
case "top":
case "left":
case "bottom":
oElement.style[attr] = value + "px";
break;
case "opacity" :
oElement.style.filter = "alpha(opacity=" + value + ")";
oElement.style.opacity = value / 100;
break;
default :
oElement.style[attr] = value;
break
}
}
},
doMove : function (oElement, oAttr, fnCallBack)
{
var _this = this;
clearInterval(oElement.timer);
oElement.timer = setInterval(function ()
{
var bStop = true;
for (var property in oAttr)
{
var iCur = parseFloat(_this.css(oElement, property));
property == "opacity" && (iCur = parseInt(iCur.toFixed(2) * 100));
var iSpeed = (oAttr[property] - iCur) / 5;
iSpeed = iSpeed > 0 ? Math.ceil(iSpeed) : Math.floor(iSpeed);

if (iCur != oAttr[property])
{
bStop = false;
_this.css(oElement, property, iCur + iSpeed)
}
}
if (bStop)
{
clearInterval(oElement.timer);
fnCallBack && fnCallBack.apply(_this, arguments)
}
}, 30)
},addClick:function (num){
//alert(num);
// if (this.index > _this.iCenter)
// {
// for (var i = 0; i < this.index - _this.iCenter; i++) _this.aSort.push(_this.aSort.shift());
// _this.setUp()
// }
}
};
window.onload = function ()
{
new ZoomPic("box");
};
function tt(){
//alert(1);

}

OK,最后加上一些样式上的东西,就可以跑起来了;
复制代码 代码如下:
body {
margin: 0px; padding: 0px;
}
div {
margin: 0px; padding: 0px;
}
ul {
margin: 0px; padding: 0px;
}
li {
margin: 0px; padding: 0px;
}
h4 {
margin: 0px; padding: 0px;
}
p {
margin: 0px; padding: 0px;
}
body {
no-repeat 50% 0px rgb(0, 0, 0); font: 12px/1.8 arial; color: rgb(255, 255, 255); font-size-adjust: none; font-stretch: normal;
}
a {
background: rgb(102, 102, 102); padding: 2px 5px; color: rgb(255, 255, 255); text-decoration: none;
}
a:hover {
background: rgb(255, 153, 0);
}
#box {
margin: 1px auto 0px; width: 680px; height: 320px; position: relative;
}
#box ul {
width: 680px; height: 320px; position: relative;
}
#box li {
background: rgb(0, 0, 0); list-style: none; border-radius: 3px; border:0px solid rgb(0, 0, 0); left: 377px; top: 146px; width: 0px; height: 0px; overflow: hidden; position: absolute; z-index: 0; cursor: pointer;
}
#box li div {
background: rgb(0, 0, 0); width: 100%; height:40px; bottom: -100px; position: absolute; opacity: 0.7;
}
#box li div h4 {
font: 12px/24px arial; margin: 0px 10px; border-bottom-color: rgb(51, 51, 51); border-bottom-width: 1px; border-bottom-style: solid; font-size-adjust: none; font-stretch: normal;
}
#box li div h4 span {
color: red; margin-left: 10px;
}
#box li div p {
margin: 5px 10px 0px; text-indent: 2em;
}
.numbutLeft{width: 15px; height: 5px; background-color:#AFB7B6; float: left; cursor: pointer;}
.numbut{width: 15px; height: 5px; background-color:#AFB7B6; float: left; margin-left: 5px; cursor: pointer;}
.numbutCen{width: 15px; height: 5px; background-color:#FF0000; float: left; margin-left: 5px; cursor: pointer;}
.numbutLeftCen{width: 15px; height: 5px; background-color:#FF0000; float: left; cursor: pointer;}
.numbutdiv{height: 10px;width: 100%;color: red;margin-top: 0px; padding-top: 0px}
.ndv{height: 10px;width: 95px; margin: 0 auto}
#box .next {
background-position: -39px 0px; right: -60px;
}
#copyright {
text-align: center; padding-top: 10px;
}

OOOOOKKK 了,奇特的效果就要出来了 ,还有一些不完美的地方,懒得去改了,有高手可以改改看,但希望分享哦。
效果如下:

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章