views:

65

answers:

2

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.

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

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.

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...

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.

Thanks everyone. jf

A: 

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:

$(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().

wambotron
Excellent. $(window).load() worked! It does lag a bit to get the script running when the page is first loaded, but it works. Yeah. Thank you for the help!
Jacob
This is my first time here, so I can't vote up your response. I'm sorry, is there anything I can do as such a n ew user? I'd like to give you props.
Jacob
Yeah, the problem with $(window).load() is that it waits for everything to load (including the scripts that GetResponse puts in.. jQuery!), so it does have a bit of a delay.The real issue is that GetResponse should be check to see if jQuery exists BEFORE putting those scripts into the page. Unfortunately, you have no control over that.I'm not sure what new user abilities are available.. it's been a while since I first signed up! haha
wambotron
A: 

A much simpler thing that might fix it for you (worked for me):

Move their script to your page head.

Mike Caskey