Issue 2314: Image rendering problem in IE8 when there's a delay during the loading is fixed.

git-svn-id: http://xe-core.googlecode.com/svn/branches/luminous@11144 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
nagoon97 2012-09-03 10:13:55 +00:00
parent e27d4f7bbc
commit 815e6b5bef
2 changed files with 14 additions and 5 deletions

View file

@ -19,10 +19,19 @@ var slideShow = xe.createPlugin('slideShow', {
API_SHOW_SLIDE : function(sender, params) {
var self=this, srl = params[0], key = '@'+srl, imgs, $zone, $thumb, $holder, i, c;
var p = params;
imgs = this.cast('GET_IMAGES', [srl]);
if(!imgs.length) return;
for(var i=0, nLen=imgs.length; i<nLen; i++){
if(!imgs[i].loaded){
setTimeout(function(){
self.cast('SHOW_SLIDE', params);
}, 200);
return;
}
}
$zone = $('#zone_slide_gallery_'+srl);
$holder = $zone.find('.slide_gallery_placeholder').css('overflow', 'hidden');

View file

@ -3,7 +3,7 @@
* @brief Slideshow type image gallery plugin
* @author NHN (developers@xpressengine.com)
**/
(function(k){var m=xe.createPlugin("slideShow",{_holders:{},_thumbs:{},_current:{},init:function(){this._holders={};this._thumbs={};this._current={}},API_SHOW_SLIDE:function(g,f){var b=this,a=f[0],c="@"+a,d,e,j,i,h,l;d=this.cast("GET_IMAGES",[a]);if(d.length){e=k("#zone_slide_gallery_"+a);i=e.find(".slide_gallery_placeholder").css("overflow","hidden");e.find(".slide_gallery_loading_text").remove();j=e.find(".slide_gallery_thumbnail_image_box").show();h=0;for(l=d.length;h<l;h++)d[h].$obj.clone().css({cursor:"pointer",
width:"60px",height:"60px",margin:"5px",opacity:0.5}).click({idx:h},function(c){b.cast("SET_SLIDE",[a,c.data.idx])}).appendTo(j);k("#zone_gallery_navigator_status_"+a).click(function(){j.toggle()});e.find(".__prev").click(function(){b.cast("PREV_SLIDE",[a]);return!1}).end().find(".__next").click(function(){b.cast("NEXT_SLIDE",[a]);return!1});this._holders[c]=i;this._thumbs[c]=j;this._current[c]=0;this.cast("SET_SLIDE",[a,0])}},_showSideSlide:function(g,f){var b,a;b=this.cast("GET_IMAGES",[g]);b.length&&
(a=this._current["@"+g],a+=f,0>a?a=b.length-1:a>=b.length&&(a=0),this.cast("SET_SLIDE",[g,a]))},API_NEXT_SLIDE:function(g,f){this._showSideSlide(f[0],1)},API_PREV_SLIDE:function(g,f){this._showSideSlide(f[0],-1)},API_SET_SLIDE:function(g,f){var b=f[0],a=f[1],c,d,e;c=this.cast("GET_IMAGES",[b]);if(c.length&&is_def(d=c[a]))this._current["@"+b]=a,k("#zone_gallery_navigator_status_"+b).text(a+1+"/"+c.length),this._thumbs["@"+b].find("img").eq(a).animate({opacity:1}).end().not(":eq("+a+")").animate({opacity:0.5}),
b=this._holders["@"+b],c=b.parent().innerWidth(),a=d.$obj.prop("width"),e=d.$obj.prop("height"),0==a&&(a=d.$obj.attr("width")),0==e&&(e=d.$obj.attr("height")),a>c-20&&(c-=20,e=Math.floor(e*(c/a)),a=c,d.$obj.css("cursor","pointer"),d.$obj.attr("rel","xe_gallery")),d.$obj.css({width:a,height:e,margin:"0 10px"}),b.empty().append(d.$obj)}}),i=xe.getApp("Gallery")[0];i&&i.registerPlugin(new m)})(jQuery);
(function(k){var m=xe.createPlugin("slideShow",{_holders:{},_thumbs:{},_current:{},init:function(){this._holders={};this._thumbs={};this._current={}},API_SHOW_SLIDE:function(h,f){var b=this,a=f[0],d="@"+a,c,e,j,i,g,l;c=this.cast("GET_IMAGES",[a]);if(c.length){g=0;for(e=c.length;g<e;g++)if(!c[g].loaded){setTimeout(function(){b.cast("SHOW_SLIDE",f)},200);return}e=k("#zone_slide_gallery_"+a);i=e.find(".slide_gallery_placeholder").css("overflow","hidden");e.find(".slide_gallery_loading_text").remove();
j=e.find(".slide_gallery_thumbnail_image_box").show();g=0;for(l=c.length;g<l;g++)c[g].$obj.clone().css({cursor:"pointer",width:"60px",height:"60px",margin:"5px",opacity:0.5}).click({idx:g},function(c){b.cast("SET_SLIDE",[a,c.data.idx])}).appendTo(j);k("#zone_gallery_navigator_status_"+a).click(function(){j.toggle()});e.find(".__prev").click(function(){b.cast("PREV_SLIDE",[a]);return!1}).end().find(".__next").click(function(){b.cast("NEXT_SLIDE",[a]);return!1});this._holders[d]=i;this._thumbs[d]=j;
this._current[d]=0;this.cast("SET_SLIDE",[a,0])}},_showSideSlide:function(h,f){var b,a;b=this.cast("GET_IMAGES",[h]);b.length&&(a=this._current["@"+h],a+=f,0>a?a=b.length-1:a>=b.length&&(a=0),this.cast("SET_SLIDE",[h,a]))},API_NEXT_SLIDE:function(h,f){this._showSideSlide(f[0],1)},API_PREV_SLIDE:function(h,f){this._showSideSlide(f[0],-1)},API_SET_SLIDE:function(h,f){var b=f[0],a=f[1],d,c,e;d=this.cast("GET_IMAGES",[b]);if(d.length&&is_def(c=d[a]))this._current["@"+b]=a,k("#zone_gallery_navigator_status_"+
b).text(a+1+"/"+d.length),this._thumbs["@"+b].find("img").eq(a).animate({opacity:1}).end().not(":eq("+a+")").animate({opacity:0.5}),b=this._holders["@"+b],d=b.parent().innerWidth(),a=c.$obj.prop("width"),e=c.$obj.prop("height"),0==a&&(a=c.$obj.attr("width")),0==e&&(e=c.$obj.attr("height")),a>d-20&&(d-=20,e=Math.floor(e*(d/a)),a=d,c.$obj.css("cursor","pointer"),c.$obj.attr("rel","xe_gallery")),c.$obj.css({width:a,height:e,margin:"0 10px"}),b.empty().append(c.$obj)}}),i=xe.getApp("Gallery")[0];i&&i.registerPlugin(new m)})(jQuery);