欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

jquery 判断图片加载完毕

shiping1 的头像

简单来说是对象加载完毕后的回调函数,在ajax中用的很多

/*图片加载完毕后移除loadign状态*/
      $("#"+set.bigImgId).load(function(){
       viewInfo.find(".view_prev,.view_next").css({width:parseInt($(this).width()/2)+"px",height:parseInt($(this).height())+"px"});
       $("."+set.dispClass).width(parseInt($(this).width())).height(parseInt($(this).height()));
       $(this).removeClass("thumbLoader");
      }).error(function(){
       //alert("404错误,图片文件不存在");
       $(this).attr({src:set.onErrorFileB})
      }); 
      
      $("."+set.thumbImgClass).load(function(){
       $("."+set.dispClass).removeClass("thumbLoader");
      }).error(function(){
       //alert("404错误,图片文件不存在");
       $(this).attr({src:set.onErrorFileB})
      });

 

来自 http://www.designcss.org/qianduan/single/395

普通分类: