js实现图片从左往右渐变切换效果的方法

所属分类: 网络编程 / JavaScript 阅读数: 432
收藏 0 赞 0 分享

本文实例讲述了js实现图片从左往右渐变切换效果的方法。分享给大家供大家参考。具体实现方法如下:

复制代码 代码如下:

<style type="text/css">
.woon{border:1px solid #fff;}
.wooff{border:1px solid #ffffff;filter:progid:DXImagetransform.Microsoft.Alpha(style=1,opacity=1500,finishOpacity=1);}
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
window.onerror = function(){return true}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</script>
<table width=500 border=0 align=center cellPadding=0 cellSpacing=0  background="http://s16.sinaimg.cn/middle/60d27f6dt7942731cd87f&690">
    <tr>
      <td height="300" align="center">
        <div id=fc style="filter:progid:DXImagetransform.Microsoft.GradientWipe(duration=3,gradientSize=0.5,motion=forward ); WIDTH:500px; HEIGHT:260px; border:1px solid #99cc66">
          <div style="display:block"><A
                  href="#" target=_blank><img onmouseover=clearAuto(); onmouseout=setAuto() height=300 src="https://zhanzhang360.qulang.net/imgupload/007092/60d27f6dtbc987f277bde&690" width=500 border=0></A></div>
        
        <div style="display: none"><a href="#" target="_blank"><img onmouseover=clearAuto(); onmouseout=setAuto() height=300 src="https://zhanzhang360.qulang.net/imgupload/007092/60d27f6dtbc987f42b6b9&690" width=500 border=0></a></div>
        
        <div style="display: none"><A href="#" target=_blank><img onmouseover=clearAuto(); onmouseout=setAuto() height=300 src="https://zhanzhang360.qulang.net/imgupload/007092/60d27f6dtbc987f3c3303&690" width=500 border=0></A></div>
        <div style="display: none"><a href="#" target=_blank><img onmouseover=clearAuto(); onmouseout=setAuto() height=300 src="https://zhanzhang360.qulang.net/imgupload/007092/60d27f6dt7942732166fb&690" width=500 border=0></a></div>
      </div></td>
    </tr>
    <tr>
      <td height=100 valign="top"> <table border=0 align=center cellPadding=0 cellSpacing=1 id=num>     
          <tr>
           
          <td class=woon onmouseover=clearAuto();onclick=Mea(0); onmouseout=setAuto() >
   <img src="https://zhanzhang360.qulang.net/imgupload/007092/60d27f6dtbc987f277bde&690" width="120" height="70" style="cursor: hand" onDblClick="MM_openBrWindow('#','','')"></td>
           
          <td class=wooff onmouseover=clearAuto(); onclick=Mea(1); onmouseout=setAuto() >
      <img src="https://zhanzhang360.qulang.net/imgupload/007092/60d27f6dtbc987f42b6b9&690" width="120" height="70" border="0" style="cursor: hand" onDblClick="MM_openBrWindow('#','','')"></td>
          <td class=wooff onmouseover=clearAuto(); onclick=Mea(2); onmouseout=setAuto() >
   <img src="https://zhanzhang360.qulang.net/imgupload/007092/60d27f6dtbc987f3c3303&690" width="120" height="70" style="cursor: hand" onDblClick="MM_openBrWindow('#','','')"></td>
           
          <td class=wooff onmouseover=clearAuto(); onclick=Mea(3); onmouseout=setAuto() >
   <img src="https://zhanzhang360.qulang.net/imgupload/007092/60d27f6dt7942732166fb&690" width="120" height="70" style="cursor: hand" onDblClick="MM_openBrWindow('#','','')"></td>
      </table>
<script>
var n=0;
var showNum = document.getElementByIdx_x("num");
function Mea(value){
 n=value;
 setBg(value);
 plays(value);
 }
function setBg(value){
 for(var i=0;i<4;i++)
   if(value==i){
  showNum.getElementsByTagName_r("td")[i].className='woon';
  }
 else{
  showNum.getElementsByTagName_r("td")[i].className='wooff';
  }
 }
function plays(value){
 with (fc){
  filters[0].Apply();
  for(i=0;i<4;i++)i==value?children[i].style.display="block":children[i].style.display="none";
  filters[0].play(); 
  }
}
function clearAuto(){clearInterval(autoStart)}
function setAuto(){autoStart=setInterval("auto(n)", 5000)}
function auto(){
 n++;
 if(n>3)n=0;
 Mea(n);
}
function sub(){
 n--;
 if(n<0)n=3;
 Mea(n);
}
setAuto();
</script>
</body>
</html>

希望本文所述对大家的javascript程序设计有所帮助。

更多精彩内容其他人还在看

BootStrap数据表格实例代码

本文通过实例代码给大家分享了BootStrap数据表格的相关知识,感兴趣的朋友一起看看吧
收藏 0 赞 0 分享

基于vue的短信验证码倒计时demo

这篇文章主要介绍了基于vue的短信验证码倒计时demo,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
收藏 0 赞 0 分享

详解React Native开源时间日期选择器组件(react-native-datetime)

本篇文章主要介绍了详解React Native开源时间日期选择器组件(react-native-datetime),具有一定的参考价值,有兴趣的可以了解一下
收藏 0 赞 0 分享

JS库particles.js创建超炫背景粒子插件(附源码下载)

particles.js用于创建粒子的轻量级 JavaScript 库。使用方法非常简单,代码也很容易实现,下面通过本文给大家分享JS库particles.js创建超炫背景粒子插件附源码下载,需要的朋友参考下吧
收藏 0 赞 0 分享

JS库之Waypoints的用法详解

waypoints的功能非常强大,一款用于捕获各种滚动事件的插件,下面跟随脚本之家小编一起学习JS库之Waypoints的用法吧
收藏 0 赞 0 分享

强大的JavaScript响应式图表Chartist.js的使用

本篇文章主要介绍了强大的JavaScript响应式图表Chartist.js的使用,具有一定的参考价值,有兴趣的可以了解一下
收藏 0 赞 0 分享

详解wow.js中各种特效对应的类名

本篇文章主要介绍了wow.js中各种特效对应的类名 ,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
收藏 0 赞 0 分享

JS库之Highlight.js的用法详解

highlight.js是一款轻量级的Web代码语法高亮库。下面通过实例代码给大家分享JS库之Highlight.js的用法详解,感兴趣的朋友跟随脚本之家小编一起学习吧
收藏 0 赞 0 分享

详解动画插件wow.js的使用方法

本篇文章主要介绍了动画插件wow.js的使用方法,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
收藏 0 赞 0 分享

JS库 Highlightjs 添加代码行号的实现代码

Highlightjs是一款优秀的代码高亮Js组件,可以很方便地对各种语言编写的代码添加语法高亮样式。本文重点给大家介绍Highlightjs 添加代码行号的实现代码,需要的朋友参考下吧
收藏 0 赞 0 分享
查看更多