📄 adrotator.js
字号:
var imgs = new Array();
var srcImgHtml;
var _internal = 3000;
var _isStop;
var _playIndex;
//滚动条移动 @scrollwidth : 移动宽度
function scrollHiddenDiv(div, scrollwidth)
{
div.scrollLeft += scrollwidth;
}
//相册图片
var ShowPhotoBar = {
ImgsList : [],
Imgs :[],
S_Obj : null,
S_ok : 0,
S_ele : null,
S_w : 0,
n : 20,
t : 50,
k : 0,
timers : null,
get : function(){
ShowPhotoBar.S_Obj = $("scroll").getElementsByTagName("LI");
ShowPhotoBar.S_ok = Math.ceil(ShowPhotoBar.S_Obj.length/3)-1;
ShowPhotoBar.S_ele = $("scrollbar");
ShowPhotoBar.S_w = ShowPhotoBar.S_ele.clientWidth;
ShowPhotoBar.timers = new Array(ShowPhotoBar.n);
},
//滚动方向ONCLICK事件
doSlide : function(s){
if (ShowPhotoBar.S_Obj==null)
{
ShowPhotoBar.get();
}
if (ShowPhotoBar.k>=ShowPhotoBar.S_ok &&s>0|| ShowPhotoBar.k<=0 &&s<0){alert("抱歉,所有家当都给您展示出来了!^_^ ")}
else{
ShowPhotoBar.k+=s;
var x=ShowPhotoBar.S_ele.scrollLeft;
var d=ShowPhotoBar.k*ShowPhotoBar.S_w-x;
for(var i=0;i<ShowPhotoBar.n;i++)(
function(){
if(ShowPhotoBar.timers[i]) clearTimeout(ShowPhotoBar.timers[i]);
var j=i;
ShowPhotoBar.timers[i]=setTimeout(function(){ShowPhotoBar.S_ele.scrollLeft=x+Math.round(d*Math.sin(Math.PI*(j+1)/(2*ShowPhotoBar.n)));},(i+1)*ShowPhotoBar.t);
}
)();
};},
//滚动条图片HTML数据
InnerImgsbar : function(div){
var piclist = ShowPhotoBar.ImgsList;
var count = piclist.length;
var html = "";
for (var i = 0; i < count; i += 1) {
//imgs[i] = new Image();
//imgs[i].src = piclist[i].pic;
html +="<li>";
html +="<a href=\""+piclist[i].url+"\"><img src=\""+piclist[i].pic+"\" title=\""+piclist[i].title+"\" class=\"ImgBox\"/></a>";
html +="</li>";
};
if (div)
{
div.innerHTML = html;
};
},
//sliverlight 图片数据
SilverlightShow : function(){
var piclist = ShowPhotoBar.ImgsList;
var count = piclist.length;
for (var i = 0; i < count; i += 1) {
if (i>11)
{
break;
}else{
Dvbbs.AlbumImages[i] = piclist[i].pic;
};
};
}
}
// 相册幻灯播放控制类
/* 播放设置 */
var adRotator = ({});
adRotator.loads = function ()
{
if (_playIndex < imgs.length && _isStop < 1)
{
//$('rotatorPlayer').innerHTML = '<center><img id="showimg" src="' + imgs[_playIndex].src + '" onClick="adRotator.browse();" style="cursor: pointer;"></center>';
$('rotatorPlayer').innerHTML = '<center><img id="showimg" src="' + (imgs[_playIndex - 1] ? imgs[_playIndex - 1].src : imgs[_playIndex].src) + '" onClick="adRotator.browse();" style="cursor: pointer;"></center>';
transImg(0);
transImg(1);
$('showimg').src = imgs[_playIndex].src;
_playIndex = _playIndex + 1;
transImg(0);
if(_isStop < 1)
window.setTimeout("adRotator.loads(" + _playIndex + ")",_internal);
if (_playIndex + 1 > imgs.length)
_playIndex = 0;
}
}
/* 播放 */
adRotator.play = function ()
{
if(imgs.length <= 0)
return;
_isStop = 0;
_playIndex = 0;
//document.getElementById('stop').disabled='';
//document.getElementById('play').disabled='true';
srcImgHtml = $('rotatorPlayer').innerHTML;
adRotator.loads();
}
/* 停止播放 */
adRotator.stop = function ()
{
_isStop = 1;
//document.getElementById('stop').disabled='true';
//document.getElementById('play').disabled='';
$('rotatorPlayer').innerHTML = srcImgHtml;
}
/* 浏览 */
adRotator.browse = function ()
{
var oBrowse = $('browse');
var oSet = $("set");
var oSecond = $("second");
if("幻灯播放" == oBrowse.value)
{
oBrowse.value = "停止播放";
oSet.style.display = "";
oSecond.style.display = "";
this.play();
}
else
{
oBrowse.value = "幻灯播放";
oSet.style.display = "none";
oSecond.style.display = "none";
this.stop();
}
}
adRotator.reSize = function(img)
{
if(650 < img.width)
{
img.width = 650;
}
}
/* 间隔时间 */
adRotator.set = function ()
{
var _sfc = document.getElementById('second').value;
if (isInteger(_sfc)){
_internal = _sfc * 1000;
}
else{
alert('提示:只能输入数字!');
$('second').value=5;
$('second').select();
}
}
function onplayalubm()
{
}
/* 渐隐渐现 */
function transImg(enable)
{
if(window.netscape){return;}
$("showimg").style.filter = "alpha(opacity=1,enabled=1) blendtrans(duration=2) revealTrans(duration=2,transition=20)";
adRotator.reSize($("showimg"));
$("showimg").filters.revealTrans.Transition=Math.floor(Math.random()*23);
$("showimg").filters.revealTrans.apply();
$("showimg").filters.blendtrans.Apply();
$("showimg").filters[0].enabled=enable;
$("showimg").filters.revealTrans.Play();
$("showimg").filters.blendtrans.Play();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -