繁体   English   中英

jQuery:使用.load()附加到图像的函数永远不会在IE中调用

[英]jQuery: function attached to image with .load() never gets called in IE

我在图像加载时将功能附加到图像上:

this.img.load( function(self){ return function(){
   self.ready = true;
   // more code
}; }(this) );

this是一个对象, this.img是图像对象。 在Internet Explorer中,永远不会调用该函数。 它可以在Safari,Firefox和Chrome中正常运行。

我对IE不太熟悉,非常感谢您的帮助。 这里的完整源代码(第125行)。

在将src属性分配给img对象之前,请尝试分配负载方法。

@travelboy。 jQuery具有加载方法。

http://api.jquery.com/load-event/

您是否已检查4特定事件?

$('img.userIcon').load(function(){
  if($(this).height() > 100) {
    $(this).addClass('bigImg');
  }
});

暂无
暂无

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

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