我正在使用一个名为SimpleGallery的jQuery画廊插件。
当我加载页面时,每个浏览器中的一切都很完美。但是当我在Internet Explorer 7中刷新页面时,图像将不再加载。
这是我的页面:https://www.cap47fb.com/bulthaup/welkom/
这是我的代码:
$(document).ready(function(){
var mygallery=new simpleGallery({
wrapperid: "simplegallery1", //ID of main gallery container,
dimensions: [520, 721], //width/height of gallery in pixels. Should reflect dimensions of the images exactly
imagearray: [
["https://www.cap47fb.com/bulthaup/images/welcome_1.jpg", "", "", ""],
["https://www.cap47fb.com/bulthaup/images/welcome_2.jpg", "", "", ""]
],
autoplay: [true, 5000, 20], //[auto_play_boolean, delay_btw_slide_millisec, cycles_before_stopping_int]
persist: true, //remember last viewed slide and recall within same session?
fadeduration: 1000, //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)
}
})
});
仅当您将光标放在地址栏中并单击回车时才会发生这种情况。当您点击浏览器的“刷新”按钮时,它可以正常工作......
此网页将在Facebook页面上用作iframe,因此当您点击其他应用并返回上一个应用时,也会出现此问题。
我已将代码放在document.ready函数中,所以我确信每次访问或重新访问页面时,都会重新加载simplegallery,对吗?
答案 0 :(得分:1)
我在动态驱动器中找到了解决方案:
使用像NotePad这样的纯文本编辑器,在simplegallery.js文件中找到此部分:
代码:
for (var i=0; i<setting.imagearray.length; i++){ //preload slideshow images
preloadimages[i]=new Image()
preloadimages[i].src=setting.imagearray[i][0]
if (setting.imagearray[i][3] && setting.imagearray[i][3].length>setting.longestdesc.length)
setting.longestdesc=setting.imagearray[i][3]
jQuery(preloadimages[i]).bind('load error', function(){
loadedimages++
if (loadedimages==setting.imagearray.length){
dfd.resolve() //indicate all images have been loaded
}
})
}
替换为:
代码:
for (var i=0; i<setting.imagearray.length; i++){ //preload slideshow images
preloadimages[i]=new Image()
if (setting.imagearray[i][3] && setting.imagearray[i][3].length>setting.longestdesc.length)
setting.longestdesc=setting.imagearray[i][3]
jQuery(preloadimages[i]).bind('load error', function(){
loadedimages++
if (loadedimages==setting.imagearray.length){
dfd.resolve() //indicate all images have been loaded
}
})
preloadimages[i].src=setting.imagearray[i][0]
}