加入收藏 | 设为首页 | 会员中心 | 我要投稿 | RSS
您当前的位置:首页 > 网页特效 > 图片特效
广告特效 | 图片特效 | 文字特效 | 按钮特效 | 鼠标特效 | 窗口特效 | 时间特效 |
菜单导航 | 状态栏特效 | 标题栏特效 |
468x15

js图片自动切换代码

时间:2013-10-17 22:13:45  来源:  作者:

js图片自动切换代码

<!-- 把下列代码加到<body>区域内 --><script>var zoomimages=new Array("/edu/img/js/200909/8.jpg","/edu/img/js/200909/7.jpg","/edu/img/js/200909/5.jpg","/edu/img/js/200909/4.jpg","/edu/img/js/200909/3.jpg")</script><script>// more javascript from /var imgpreload=new Array()for (i=0;i<=zoomimages.length;i++) { imgpreload[i]=new Image() imgpreload[i].src=zoomimages[i]}var zoomfactor=8var positionleft=0var positiontop=0var timervar marginright=0var i_fadestrength=5var i_images=0var step=1var contentvar imageboxwidthriginal=0var imageboxwidth=0var imageboxheight=0var bodywidth=0var bodyheight=0function setimage() { document.all.imagebox.style.visibility="hidden" bodywidth=document.body.clientWidth bodyheight=document.body.clientHeight if (i_images>=zoomimages.length) {i_images=0} content="<img name='newpic' src='"+zoomimages[i_images]+"'>" imagebox.innerHTML=content imageboxwidthoriginal=document.newpic.width content="<img name='newpic' src='"+zoomimages[i_images]+"' width=1>" imagebox.innerHTML=content document.all.imagebox.style.visibility="visible" imagebox.filters.alpha.opacity=100 zoomin()}function zoomin() { if (imageboxwidth<(imageboxwidthoriginal/1.3)) {  imageboxwidth+=zoomfactor  content="<img name='newpic' src='"+zoomimages[i_images]+"' width='"+imageboxwidth+"'>"  imagebox.innerHTML=content  imageboxwidth=document.newpic.width  imageboxheight=document.newpic.height  document.all.imagebox.style.posLeft=bodywidth/2-imageboxwidth/2  document.all.imagebox.style.posTop=bodyheight/2-imageboxheight/2  document.all.imagebox.style.overflowX="hidden"  document.all.imagebox.style.visibility="visible"  step+=1.1  imageboxwidth+=step  timer=setTimeout("zoomin()",50)}else { clearTimeout(timer) content="<img name='newpic' src='"+zoomimages[i_images]+"' width='"+imageboxwidthoriginal+"'>" imagebox.innerHTML=content imageboxwidth=document.newpic.width imageboxheight=document.newpic.height document.all.imagebox.style.posLeft=bodywidth/2-imageboxwidth/2 document.all.imagebox.style.posTop=bodyheight/2-imageboxheight/2 document.all.imagebox.style.overflowX="hidden" document.all.imagebox.style.visibility="visible" i_fadestrength=0; timer=setTimeout("zoomout()",2000) }}function zoomout() {if (i_fadestrength<120) { imageboxwidth+=zoomfactor content="<img name='newpic' src='"+zoomimages[i_images]+"' width='"+imageboxwidth+"'>" imagebox.innerHTML=content imageboxwidth=document.newpic.width imageboxheight=document.newpic.height imagebox.filters.alpha.opacity=Math.floor(100-i_fadestrength) document.all.imagebox.style.posLeft=bodywidth/2-imageboxwidth/2 document.all.imagebox.style.posTop=bodyheight/2-imageboxheight/2 document.all.imagebox.style.overflowX="hidden" document.all.imagebox.style.visibility="visible" step+=1.5 i_fadestrength+=step timer=setTimeout("zoomout()",50)}else { clearTimeout(timer) i_fadestrength=0; step=1; i_images++ imageboxwidth=0 setimage() }}if (document.all) { document.write("<DIV id='imagebox' style='position:absolute;filter:alpha(opacity=0);'></DIV>")}if (document.all) { onload=setimage}</script>



来顶一下
返回首页
返回首页
赞助商链接广告
推荐下载
  • jQuery鼠标拖动图片拖动动画特效代码
  • 网页特效图片渐变效果
  • 网页特效图形显示特效
  • 网页特效特殊的图像显示
  • 网页特效图片自动切换
  • 水韵效果特效代码
  • 不停闪烁的图片
  • 赞助商链接广告
    最后更新
  • js制作当前图片高亮和图片放大聚焦效果
  • js智能缩放点击图片放大预览代码
  • CSS3鼠标经过图片旋转放大特效
  • css3 filter滤镜属性制作的图片美化特效
  • jQuery图片堆叠左右切换代码
  • jQuery响应式图片切换无缝切换代码
  • jQuery鼠标拖动图片拖动动画特效代码
  • 图片放大预览网页特效代码
  • 网页相册特效代码
  • js图片自动切换代码
  • 赞助商链接广告