分享
 
 
 

一种特殊效果的图片滚动代码[网页特效]

王朝html/css/js·作者佚名  2006-11-24
窄屏简体版  字體: |||超大  

有什么问题请到<a href='/bbs/forums.php?fid=21'>论坛</a>中发表<br>

<!-- http://www.webjx.com/ -->

<!-- bbs http://www.webjx.com/bbs-->

<!-- 把下列代码加到<body>区域内 -->

<SCRIPT>

// more javascript from http://www.webjx.com

// URLs of slides

var slideurl=new Array("/img/200406301.jpg","/img/200406302.jpg","/img/200406303.jpg","/img/200406304.jpg")

// comments displayed below the slides

var slidecomment=new Array("Mary","Jane","Rita","Tina")

// links for each slide

var slidelink=new Array("http://www.webjx.com","http://www.webjx.com","http://www.webjx.com","http://www.webjx.com")

// targets of the links. Allowed values: "_parent", "_top", "_blank", "_self"

var slidetarget=new Array("_blank","_blank","_blank","_blank")

// the width of the slideshow (pixels)

var scrollerwidth=160

// the height of the slideshow (pixels)

var scrollerheight=100

// width of the transparent zones (pixels)

var translayerszone=40

// font-attributes for the comments

var slidefont="Arial"

var slidefontcolor="blue"

var slidefontsize="2"

// background-color of webpage

var pagebgcolor="#FFFFFF"

// do not edit below this line

var translayerswidth=1

var translayersmax=Math.floor(translayerszone/translayerswidth)

var translayersleftpos=0

var translayersopacity=100

var translayersfactor=100/translayersmax

var translayerswidthall=translayersmax*translayerswidth

var allpicturewidth

var distancepictopic=0

var scrollerleft=0

var scrollertop=0

var pause=20

var step=2

var newstep=step

var clipleft,clipright,cliptop,clipbottom

var i_picture=0

var timer

var picturecontent=""

var ns4=document.layers?1:0

var ns6=document.getElementById&&!document.all?1:0

var ie=document.all?1:0

var browserinfos=navigator.userAgent

var opera=browserinfos.match(/Opera/)

var preloadedimages=new Array()

for (i=0;i<slideurl.length;i++){

preloadedimages[i]=new Image()

preloadedimages[i].src=slideurl[i]

}

function init() {

if (ie) {

allpicturewidth=document.all.picturediv.offsetWidth

document.all.picturediv.style.posTop=scrollertop

document.all.picturediv.style.posLeft=scrollerleft+scrollerwidth

clipleft=0

clipright=0

cliptop=0

clipbottom=scrollerheight

document.all.picturediv.style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"

document.all.picturediv.style.visibility="visible"

scrollpicture()

}

if (ns6) {

allpicturewidth=document.getElementById('emptypicturediv').offsetWidth

document.getElementById('picturediv').style.top=scrollertop

document.getElementById('picturediv').style.left=scrollerleft+scrollerwidth

clipleft=0

clipright=0

cliptop=0

clipbottom=scrollerheight

document.getElementById('picturediv').style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"

document.getElementById('picturediv').style.visibility="visible"

scrollpicture()

}

if (ns4) {

allpicturewidth=document.roof.document.picturediv.document.width

document.roof.document.picturediv.top=scrollertop

document.roof.document.picturediv.left=scrollerleft+scrollerwidth

document.roof.document.picturediv.clip.left=0

document.roof.document.picturediv.clip.right=0

document.roof.document.picturediv.clip.top=0

document.roof.document.picturediv.clip.bottom=scrollerheight

document.roof.document.picturediv.visibility="visible"

scrollpicture()

}

}

function scrollpicture() {

if (ie) {

if (document.all.picturediv.style.posLeft>=scrollerleft-allpicturewidth) {

document.all.picturediv.style.posLeft-=step

clipright+=step

if (clipright>scrollerwidth) {

clipleft+=step

}

document.all.picturediv.style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"

var timer=setTimeout("scrollpicture()",pause)

}

else {

resetposition()

}

}

if (ns6) {

if (parseInt(document.getElementById('picturediv').style.left)>=scrollerleft-allpicturewidth) {

document.getElementById('picturediv').style.left=parseInt(document.getElementById('picturediv').style.left)-step

clipright+=step

if (clipright>scrollerwidth) {

clipleft+=step

}

document.getElementById('picturediv').style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"

var timer=setTimeout("scrollpicture()",pause)

}

else {

resetposition()

}

}

if (ns4) {

if (document.roof.document.picturediv.left>=scrollerleft-allpicturewidth) {

document.roof.document.picturediv.left-=step

document.roof.document.picturediv.clip.right+=step

if (document.roof.document.picturediv.clip.right>scrollerwidth) {

document.roof.document.picturediv.clip.left+=step

}

var timer=setTimeout("scrollpicture()",pause)

}

else {

resetposition()

}

}

}

function onmsover() {

step=0

}

function onmsout() {

step=newstep

}

function resetposition() {

if (ie) {

document.all.picturediv.style.posLeft=scrollerleft+scrollerwidth

clipleft=0

clipright=0

document.all.picturediv.style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"

scrollpicture()

}

if (ns6) {

allpicturewidth=document.getElementById('emptypicturediv').offsetWidth

document.getElementById('picturediv').style.left=scrollerleft+scrollerwidth

clipleft=0

clipright=0

document.getElementById('picturediv').style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"

scrollpicture()

}

if (ns4) {

document.roof.document.picturediv.left=scrollerleft+scrollerwidth

document.roof.document.picturediv.clip.left=0

document.roof.document.picturediv.clip.right=0

scrollpicture()

}

}

picturecontent=""

picturecontent+="<table cellpadding=2 cellspacing=0>"

picturecontent+="<tr>"

for (i=0;i<=slideurl.length-1;i++) {

picturecontent+="<td>"

picturecontent+="<a href=\""+slidelink[i]+"\" target=\""+slidetarget[i]+"\" onMouseOver=\"javascript:onmsover()\" onMouseOut=\"javascript:onmsout()\">"

picturecontent+="<img src=\""+slideurl[i]+"\" border=0></a>"

picturecontent+="</td>"

}

picturecontent+="</tr>"

picturecontent+="<tr>"

for (i=0;i<=slideurl.length-1;i++) {

picturecontent+="<td>"

picturecontent+="<font face=\""+slidefont+"\" color=\""+slidefontcolor+"\" size="+slidefontsize+">"

picturecontent+=slidecomment[i]

picturecontent+="</font>"

picturecontent+="</td>"

}

picturecontent+="</tr>"

picturecontent+="</tr></table>"

if (ie || ns6) {

document.write('<div style="position:relative;width:'+scrollerwidth+'px;height:'+scrollerheight+'px;overflow:hidden">')

document.write('<div id="picturediv" style="position:absolute;top:0px;left:0px;height:'+scrollerheight+'px;visibility:hidden">'+picturecontent+'</div>')

if (ie && !opera) {

for (i=0;i<=translayersmax;i++) {

document.write('<span ID="trans'+i+'" style="position:absolute;top:0px;left:'+translayersleftpos+'px;width:'+translayerswidth+'px;height:'+scrollerheight+'px;background-color:'+pagebgcolor+';filter:alpha(opacity='+translayersopacity+');overflow:hidden"> </span>')

translayersleftpos+=translayerswidth

translayersopacity-=translayersfactor

}

translayersleftpos=scrollerwidth-translayersleftpos

for (ii=0;ii<=translayersmax;ii++) {

document.write('<span ID="trans'+ii+'" style="position:absolute;top:0px;left:'+translayersleftpos+'px;width:'+translayerswidth+'px;height:'+scrollerheight+'px;background-color:'+pagebgcolor+';filter:alpha(opacity='+translayersopacity+');overflow:hidden"> </span>')

translayersleftpos+=translayerswidth

translayersopacity+=translayersfactor

}

}

if (ns6 && !opera) {

for (i=0;i<=translayersmax-1;i++) {

document.write('<span ID="transleft'+i+'" style="position:absolute;top:0px;left:'+translayersleftpos+'px;width:'+translayerswidth+'px;height:'+scrollerheight+'px;background-color:'+pagebgcolor+';-moz-opacity:'+translayersopacity/100+';overflow:hidden"> </span>')

translayersleftpos+=translayerswidth

translayersopacity-=translayersfactor

if (translayersopacity<0) {translayersopacity=0.001}

}

translayersleftpos=scrollerwidth-translayersleftpos

translayersopacity=0.001

for (i=0;i<=translayersmax-1;i++) {

document.write('<span ID="transright'+i+'" style="position:absolute;top:0px;left:'+translayersleftpos+'px;width:'+translayerswidth+'px;height:'+scrollerheight+'px;background-color:'+pagebgcolor+';-moz-opacity:'+translayersopacity/100+';"> </span>')

translayersleftpos+=translayerswidth

translayersopacity+=translayersfactor

}

}

document.write('</div>')

document.write('<div id="emptypicturediv" style="position:absolute;top:0px;left:0px;height:'+scrollerheight+'px;visibility:hidden">'+picturecontent+'</div>')

window.onload=init

}

if (ns4) {

document.write('<ilayer name="roof" width='+scrollerwidth+' height='+scrollerheight+'>')

document.write('<layer name="picturediv" width='+scrollerwidth+' height='+scrollerheight+' visibility=hide>'+picturecontent+'</layer>')

document.write('</ilayer>')

window.onload=init

}

</script>

[1] [2] 下一页

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有