首页 > 开发 > CSS > 正文

巧用CSS滤镜制作绚丽图片播放效果

2024-07-11 08:21:33
字体:
来源:转载
供稿:网友
    css中有revealtrans滤镜在网页中制作特效非常有用处。这次,我们准备介绍另一种使用revealtrans滤镜制作出超弦图片播放的效果。

  实现思路:使用revealtrans滤镜制作出超弦图片播放的效果,并每张图片有各自的链接地址。

  制作方法:

  1、在<head>中插入js代码:

<script language=javascript1.2>
function reapply(){
settimeout("slideit()",800)
return true
}
window.onerror=reapply
</script>
<script language=javascript1.1>
<!--
//preload images
var image1=new image()
image1.src=图片地址"
var image2=new image()
image2.src=图片地址"
var image3=new image()
image3.src=图片地址"
var image4=new image()
image4.src=图片地址"
var image5=new image()
image5.src=图片地址"
var image6=new image()
image6.src=图片地址"
var image7=new image()
image7.src=图片地址"
var image8=new image()
image8.src=图片地址"
var image9=new image()
image9.src=图片地址"
//-->
</script>

  其中:images/图片地址为显示图片的路径,可按实际情况修改。

  2、在<body>中插入代码:onload=slideit()

  3、在页面中插入图片。

     
并在图片<img>中插入:style="filter: revealtrans(duration=2, transition=23)",并命名为:name=slide
  完整代码:<img src=连接地址"images/图片地址" width="120" height="90" border="0" style="filter: revealtrans(duration=2, transition=23)" name=slide>

  4、给图片加超链接:<a href="javascript:slidelink()">

  5、加入代码:
<script>
<!--
////change number of images below 
var number_of_images=9
//change speed below (in seconds)
var speed=3
var step=1
var whichimage=1
function slideit(){
if (!document.images)
return
if (document.all)
slide.filters.item(0).apply()
document.images.slide.src=eval("image"+step+".src")
if (document.all)
slide.filters.item(0).play()
whichimage=step
if (step<number_of_images)
step++
else
step=1
if (document.all)
settimeout("slideit()",speed*1000+3000)
else
settimeout("slideit()",speed*1000)
}
function slidelink(){
if (whichimage==1)
top.location.href=图片地址"/index.html"
if (whichimage==2)
top.location.href=图片地址"/news.html" 
if (whichimage==3)
top.location.href=图片地址"/game.html" 
if (whichimage==4)
top.location.href=图片地址"/music.html" 
if (whichimage==5)
top.location.href=图片地址"/sport.html" 
if (whichimage==6)
top.location.href=图片地址"/radio.html" 
if (whichimage==7)
top.location.href=图片地址"/travel.html" 
if (whichimage==8)
top.location.href=图片地址"/card.jsp" 
else if (whichimage==9)
top.location.href=图片地址"/study.html" 
}
</script>

  其中:各链接地址相对应<head>中插入的js代码中的图片。

  注意,页面地址必须与图片张数相对应。
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表