Jquery被GetResponse (email marketing) web表单脚本破坏

时间:2022-10-23 18:55:41

I'm working on a site that relies on quite a bit of javascript. The problem is, I'm not a javascript guru in the least. Yes, bit off more than I can chew, here.

我在一个网站上工作,这个网站非常依赖javascript。问题是,我根本不是一个javascript大师。是的,在这里比我能咀嚼的更多一点。

I'm using jquery for a spy effect, and use GetResponse for email signups.

我使用jquery作为间谍效果,并使用GetResponse作为电子邮件签名。

If I implement my GetResponse script, it breaks the area later in the page which depends on the jquery script. Pull the GetResponse script and it works just fine.

如果我实现了GetResponse脚本,它将在以后的页面中打破这个依赖于jquery脚本的区域。拉出GetResponse脚本,它可以正常工作。

Problem is, I need them both. ;)

问题是,我两者都需要。,)

The trick, I suppose, is that the GetResponse script is actually another Jquery script, so it's getting called twice...

我想,诀窍在于GetResponse脚本实际上是另一个Jquery脚本,所以它被调用了两次…

Any help?

任何帮助吗?

The site is http://djubi.com/testserver Check out (urlabove)/nogetresponsescript.php to see it work without the GetResponse script. You should be able to see all the source just fine.

网站是http://djubilee /testserver Check out (urlabove)/nogetresponsescript。在没有GetResponse脚本的情况下使用php。你应该可以很好地看到所有的源。

Thanks everyone. jf

谢谢每一个人。摩根富林明

1 个解决方案

#1


1  

GetResponse includes jQuery and is overwriting your plugin ($.fn.simpleSpy) when it loads jQuery again. So what you can try to do is wrap your plugin and initialization in $(document).ready(). For example:

GetResponse包括jQuery,当它再次加载jQuery时,它会覆盖您的plugin ($.fn. simplespy)。因此,您可以尝试将插件和初始化封装在$(document).ready()中。例如:

$(document).ready(function() {
  (function($) {
    $.fn.simpleSpy = function (limit, interval) {
      // snipping code out
    };
   })(jQuery);

  $(function() {
    $('ul.spy').simpleSpy();
  });
});

I pasted your code for simpleSpy into Firebug after the page loaded, and it seemed to work. If $(document).ready() doesn't work, you might want to try $(window).load().

在页面加载之后,我将您的简单代码粘贴到Firebug中,它似乎可以工作。如果$(document).ready()不起作用,您可能需要尝试$(window).load()。

#1


1  

GetResponse includes jQuery and is overwriting your plugin ($.fn.simpleSpy) when it loads jQuery again. So what you can try to do is wrap your plugin and initialization in $(document).ready(). For example:

GetResponse包括jQuery,当它再次加载jQuery时,它会覆盖您的plugin ($.fn. simplespy)。因此,您可以尝试将插件和初始化封装在$(document).ready()中。例如:

$(document).ready(function() {
  (function($) {
    $.fn.simpleSpy = function (limit, interval) {
      // snipping code out
    };
   })(jQuery);

  $(function() {
    $('ul.spy').simpleSpy();
  });
});

I pasted your code for simpleSpy into Firebug after the page loaded, and it seemed to work. If $(document).ready() doesn't work, you might want to try $(window).load().

在页面加载之后,我将您的简单代码粘贴到Firebug中,它似乎可以工作。如果$(document).ready()不起作用,您可能需要尝试$(window).load()。