jquery旋转插件抛出未捕获的异常
我在实现 jquery 旋转插件时遇到问题。我是这样实现的:
var iDirection = 90;
var dImg = $("<img/>")
.addClass('defect-image')
.attr({src: $(this).attr('IMAGE_PATH')})
.load(function(){
//do stuff if img loads without errors
})
.error(function(){
$(this).attr({src: 'img/missing.jpg' });
})
.rotate( iDirection )
.appendTo( '.image-container' );
我得到的错误是这样的:
Error: uncaught exception:
[Exception... "Component returned failure code:
0x80040111 (NS_ERROR_NOT_AVAILABLE)
[nsIDOMCanvasRenderingContext2D.drawImage]" nsresult: "0x80040111
(NS_ERROR_NOT_AVAILABLE)"
location: "JS frame :: http://my.domain.com/js/jquery.rotate.js :: anonymous :: line 51" data: no]
我需要帮助破译这个错误。我不明白这个实现我做错了什么。我也尝试过(没有运气):
.rotate({angle: iDirection })
I've got a problem when implementing the jquery rotate plugin. I implement it like this:
var iDirection = 90;
var dImg = $("<img/>")
.addClass('defect-image')
.attr({src: $(this).attr('IMAGE_PATH')})
.load(function(){
//do stuff if img loads without errors
})
.error(function(){
$(this).attr({src: 'img/missing.jpg' });
})
.rotate( iDirection )
.appendTo( '.image-container' );
The error I'm getting is this:
Error: uncaught exception:
[Exception... "Component returned failure code:
0x80040111 (NS_ERROR_NOT_AVAILABLE)
[nsIDOMCanvasRenderingContext2D.drawImage]" nsresult: "0x80040111
(NS_ERROR_NOT_AVAILABLE)"
location: "JS frame :: http://my.domain.com/js/jquery.rotate.js :: anonymous :: line 51" data: no]
I need help deciphering this error. I can't figure out what I'm doing wrong with this implementation. I've also tried (with no luck):
.rotate({angle: iDirection })
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我是你,我会将对“.rotate()”的调用放在“加载”处理程序中,或者放在“成功”处理程序中:
编辑 - 这似乎是一个有缺陷的 jQuery 插件(这个)。您可能想深入研究该项目的“问题”列表,看看某个修补版本是否有帮助,或者您可以选择其他插件。
If I were you, I'd put the call to ".rotate()" inside the "load" handler, or in a "success" handler:
edit — this seems to be a case of a buggy jQuery plugin (this one). You might want to dig through the "Issues" list for that project and see if one of the patched versions helps, or you could pick a different plugin.