简体   繁体   English

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

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

I'm using a simple image slider script. 我正在使用一个简单的图像滑块脚本。 It works perfectly in most browsers. 它可以在大多数浏览器中完美运行。

When I was testing it in IE6 with the default images, it was working fine: The default path given to the images to load was some url like this somesitename.com/image.jpg ; 当我在IE6中使用默认图像对其进行测试时,它工作正常:给图像加载的默认路径是一些网址,例如somesitename.com/image.jpg this works in IE 6 and other modern browsers. 可以在IE 6和其他现代浏览器中使用。

But when I added my images like someimages.jpg it doesn't load the images in IE6, whereas in other browsers it works fine. 但是,当我添加诸如someimages.jpg之类的图像时,它不会在IE6中加载图像,而在其他浏览器中,它可以正常工作。

Is it that my javascript supports some URL path first and then the image path? 是我的javascript首先支持某些URL路径,然后是图像路径吗?

The code below is the part where i'm editing the image path... 下面的代码是我正在编辑图像路径的部分...

<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的完整路径。

I assume that the SimpleGallery script you're using is this one: http://www.dynamicdrive.com/dynamicindex4/simplegallery.htm (I guess it is that one, because the code example you've given is identical to the one on that page). 我假设您正在使用的SimpleGallery脚本就是这样的: http : SimpleGallery (我想是那个,因为您提供的代码示例与该示例相同在该页面上)。

If so, please note that at the top of that page, it states the browsers supported by the script: "FF1+ IE7+ Opr9+". 如果是这样,请注意,在该页面的顶部,它声明了脚本支持的浏览器:“ FF1 + IE7 + Opr9 +”。

In other words, this script does not support IE6. 换句话说,此脚本不支持IE6。

You may be able to fix it, but it would likely involve hacking around with the code of the script itself. 您也许可以修复它,但是它可能涉及修改脚本本身的代码。 Probably not worth the effort. 可能不值得付出努力。

It's also worth pointing out that this script is not a jQuery plugin. 还值得指出的是,该脚本不是jQuery插件。 You've put jQuery as one of your tags on the question, so I assume you've got jQuery on your site. 你已经把jQuery的是你对这个问题的标签之一,所以我假设你有jQuery的网站上的。 If so, there are definitely other slider scripts available which do support IE6. 如果是这样,肯定还有其他支持IE6的滑块脚本可用。 I suggest your best solution would be to try one of them instead. 我建议您最好的解决方案是尝试其中之一。

Finally, the big question: do you really need to support IE6? 最后,一个大问题:您真的需要支持IE6吗? If you're in China, then the answer is maybe yes, but otherwise the answer really should be 'No'. 如果您在中国,则答案可能是肯定的,否则答案实际上应该是“否”。 IE6 usage is now down to about 0.3% of the browsers in use and falling every month, and even then a lot of that 0.3% are corporates who will be forced to upgrade in the near future when official support for IE6 (and WinXP) ends completely. IE6的使用率现在已下降到使用中的浏览器的0.3%左右,并且每个月都在下降,即使如此,在不久的将来,当对IE6(和WinXP)的官方支持终止时,很多公司仍将被迫升级。完全。

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

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