gpt4 book ai didi

javascript - SlideShow.js 在 IE 8 中不起作用

转载 作者:行者123 更新时间:2023-12-02 18:07:49 26 4
gpt4 key购买 nike

我已经使用 this msdn 中提供的 slideShow.js 创建了图像 slider 文章。

它可以在 IE 9 和 IE 10 中运行,但不能在 IE 8 中运行。

我的代码如下:

    <head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Slide Show</title>
<style type="text/css">
.size
{
height: 300px;
width: 500px;
position: relative;
}
.lab
{
background-color: rgba(0, 0, 0, 0.5);
color: #FF0000;
height: 80px;
line-height: 20px;
margin-top: 200px;
padding: 10px;
position: absolute;
width: 480px;
z-index: 100;
}
</style>
</head>

<body>
<div>

<label class="lab">This is Label</label>
<div id="slideShowImages">
<img src="Sample Images/1.jpg" alt="Slide 1" class="size" />
<img src="Sample Images/2.jpg" alt="Slide 2" class="size"/>
<img src="Sample Images/3.jpg" alt="Slide 3" class="size"/>
<img src="Sample Images/4.jpg" alt="Slide 4" class="size"/>
</div>
</div>
<script src="slideShow.js"></script>
</body>

</html>

我应该怎样做才能使幻灯片在 IE 8 中可用?请帮忙。

最佳答案

slideshow.js 的问题在于它使用了 window.addEventListener(...),该方法仅在 IE9、10 和 11 中实现。因此它在 IE8 中不起作用。

对于幻灯片,我更喜欢 jQuery Cycle .

MSDN 上的 window.addEventListener()

关于javascript - SlideShow.js 在 IE 8 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19947652/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com