Window.getComputedStyle在Firefox中未实现接口元素错误 [英] Window.getComputedStyle does not implement interface Element error in Firefox

查看:407
本文介绍了Window.getComputedStyle在Firefox中未实现接口元素错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将一些数据附加到HTML元素,所以我使用了下面的代码:

  $ ( #bookListDiv)附加(data.HTMLString)。 

并且一切都正常,但是我想在显示此元素时添加淡入淡出动画,所以我将它修改为:

  $(data.HTMLString).hide()。appendTo(#bookListDiv) .fadeIn(1000); 

动画在Chrome上运行,但在Firefox上我在控制台中看到以下错误:
TypeError :Window.getComputedStyle的参数1不实现接口元素。
我正在使用jquery 1.8.2。


你能告诉我什么可能是错的吗?我假设有数据,但在第一种方法中一切正常。

解决方案

我找到了解决方案,通过添加在淡入功能之前延迟。
更改后的代码:

  $(data.HTMLString).hide()。appendTo(#bookListDiv) .delay(100).fadeIn(1000); 

正如我注意到延迟中的数字应该调整为数据的大小,在我的它的工作原理是7KB json数据,但我从1000开始。


I'd like to append some data to the HTML element, so I've used the following code:

$("#bookListDiv").append(data.HTMLString);

and everything has working, but then I'd like to add a fadein animation while displaying this element, so I've modified it to:

$(data.HTMLString).hide().appendTo("#bookListDiv").fadeIn(1000);

Animation is working on Chrome but on Firefox I see the following error in console: TypeError: Argument 1 of Window.getComputedStyle does not implement interface Element. I'm using jquery 1.8.2.

Could you advise me what can be wrong? I supposed something with data, but in the first approach everything is working correctly.

解决方案

I've found the solution by adding the delay before fadeIn function. Code after changes:

$(data.HTMLString).hide().appendTo("#bookListDiv").delay(100).fadeIn(1000);

As I've noticed the number in delay is should be adjusted to the size of data, in my case for 7KB json data it is working, but I've started from 1000.

这篇关于Window.getComputedStyle在Firefox中未实现接口元素错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆