【问题标题】:jquery weird error in jgrowljgrowl中的jquery奇怪的错误
【发布时间】:2010-02-20 21:48:46
【问题描述】:

全部,

我使用jgrowl显示某些内容,今天我遇到了这个奇怪的错误

$(this).data("jGrowl") is undefined in jquery.jgrowl_compressed.js file in line 59

这将我指向后续行,

$(this).data("jGrowl").created=new Date();

在我的项目 js 文件中,我有以下代码

if (data)
{
 $('.jGrowl-notification:contains("' + oldtext + '")').remove();
 $.jGrowl.defaults.poll = 1;
 $.jGrowl(data, { animateOpen: { height: 'show'}, glue : 'after' , position : 'bottom-right'});
  oldtext=data;
  clean();
 }

 function clean()
 {
  $('.jGrowl-notification:contains("' + oldtext + '")').remove();
 }

当我尝试打开菜单时出现错误,在它打开之前我再次打开它..

知道可能出了什么问题。

谢谢。

【问题讨论】:

  • 编辑:我添加了更多代码来获得清晰度..

标签: jquery jquery-ui jquery-plugins jquery-selectors


【解决方案1】:

根据the API for .data(),语法应该是$(this).data("jGrowl_created", new Date()); 或类似的东西。也许你更愿意$(jGrowlElement).data("created", new Date()");

【讨论】:

  • 是的,问题与此有关,但我尝试了你所说的事情,如果我们应用你上面所说的事情,jgrowl 不会自行关闭..
  • 也许这是 jQuery 和您的 jGrowl 版本的兼容性问题,因为他们库中的代码似乎写得不好(如果 "$(this).data("jGrowl").created=new Date();" 来自他们的库)
  • 尝试更新 jQuery 和 jGrowl。如果这仍然不起作用,我认为您应该更正 jGrowl 代码(如果它确实是错误的。)
猜你喜欢
  • 2012-05-24
  • 2018-04-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-10-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多