繁体   English   中英

简单图像滑块Javascript图像路径在IE 6中不起作用

[英]Simple image slider Javascript image path not working in IE 6

我正在使用一个简单的图像滑块脚本。 它可以在大多数浏览器中完美运行。

当我在IE6中使用默认图像对其进行测试时,它工作正常:给图像加载的默认路径是一些网址,例如somesitename.com/image.jpg 可以在IE 6和其他现代浏览器中使用。

但是,当我添加诸如someimages.jpg之类的图像时,它不会在IE6中加载图像,而在其他浏览器中,它可以正常工作。

是我的javascript首先支持某些URL路径,然后是图像路径吗?

下面的代码是我正在编辑图像路径的部分...

<script type="text/javascript">
var mygallery=new simpleGallery({
    wrapperid: "simplegallery1", //ID of main gallery container,
    dimensions: [300,250], //width/height of gallery in pixels. Should reflect dimensions of the images exactly
    imagearray: [
        ["images/img-2.jpg", "#", "_new", "There's nothing like a nice swim in the Summer."],
        ["images/img-1.jpg", "#", "", ""],
        ["images/r-.jpg", "", "", "Eat your fruits, it's good for you!"],
        ["images/inside-image1.jpg", "", "", ""]
    ],
    autoplay: [true, 2500, 5], //[auto_play_boolean, delay_btw_slide_millisec, cycles_before_stopping_int]
    persist: false, //remember last viewed slide and recall within same session?
    fadeduration: 500, //transition duration (milliseconds)
    oninit:function(){ //event that fires when gallery has initialized/ ready to run
        //Keyword "this": references current gallery instance (ie: try this.navigate("play/pause"))
    },
    onslide:function(curslide, i){ //event that fires after each slide is shown
        //Keyword "this": references current gallery instance
        //curslide: returns DOM reference to current slide's DIV (ie: try alert(curslide.innerHTML)
        //i: integer reflecting current image within collection being shown (0=1st image, 1=2nd etc)
    }
})
</script>

您的someimages.jpg应该位于图像滑块代码运行所在的目录中,否则应提供someimages.jpg的完整路径。

我假设您正在使用的SimpleGallery脚本就是这样的: http : SimpleGallery (我想是那个,因为您提供的代码示例与该示例相同在该页面上)。

如果是这样,请注意,在该页面的顶部,它声明了脚本支持的浏览器:“ FF1 + IE7 + Opr9 +”。

换句话说,此脚本不支持IE6。

您也许可以修复它,但是它可能涉及修改脚本本身的代码。 可能不值得付出努力。

还值得指出的是,该脚本不是jQuery插件。 你已经把jQuery的是你对这个问题的标签之一,所以我假设你有jQuery的网站上的。 如果是这样,肯定还有其他支持IE6的滑块脚本可用。 我建议您最好的解决方案是尝试其中之一。

最后,一个大问题:您真的需要支持IE6吗? 如果您在中国,则答案可能是肯定的,否则答案实际上应该是“否”。 IE6的使用率现在已下降到使用中的浏览器的0.3%左右,并且每个月都在下降,即使如此,在不久的将来,当对IE6(和WinXP)的官方支持终止时,很多公司仍将被迫升级。完全。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM