如何赋予幻灯片褪色效果

时间:2013-11-23 18:56:50

标签: javascript asp.net

我试图在asp.net中使用JavaScript为我的幻灯片视图提供一些淡化效果

我可以提供幻灯片视图,但无法为幻灯片更改提供淡入淡出效果

每张幻灯片都有一个重定向到其他页面的链接

我的代码如下

<script type="text/javascript">
    var image1 = new Image()
    image1.src="images/SAM_0043.JPG"
    var image2 = new Image()
    image2.src = "images/SAM_0047.JPG"
    var image3 = new Image()
    image3.src="images/SAM_0044.JPG"
</script>

<body>
    <a href="javascript:slidelink()">
        <img src="images/SAM_0043.JPG" name="slide" border="0" style="width: 603px; height: 373px; z-index: 1; border-radius:10px 10px 10px 10px;left: 295px; top: 224px; position: absolute" />
    </a>

    <script type="text/javascript">
    <!--
    var step = 1
    var whichimage = 1
     function slideit() {
         if (!document.images)
             return
          document.images.slide.src = eval("image" + step + ".src")
          whichimage = step
         if (step < 3)
             step++
          else
             step = 1
         setTimeout("slideit()", 1800)
      }
      slideit()
      function slidelink() {
            if (whichimage == 1)
             window.location = "link1.htm"
         else if (whichimage == 2)
             window.location = "link2.htm"
          else if (whichimage == 3)
              window.location = "link3.htm"
      }
    //-->
    </script>
</body>

1 个答案:

答案 0 :(得分:0)

你可以使用jQuery .slideToggle()它会产生幻灯片淡化效果。