Results 1 to 6 of 6

Thread: Javascript Conflict

  1. #1
    Join Date
    Nov 2009
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Javascript Conflict

    I have two scripts that work on their own, but when I introduced magnify.js, simplecart.js stopped working. The files are:


    http://artiztic.net/yoga/simplecart.js


    http://artiztic.net/yoga/magnify.js

    can someone please help me resolve this? I don't know enough about javascript and my efforts to pinpoint the issue haven't helped.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,069
    Thanks
    44
    Thanked 3,216 Times in 3,178 Posts
    Blog Entries
    12

    Default

    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Nov 2009
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1 View Post
    There is no:
    sorry, there's a capital C

    http://artiztic.net/yoga/simpleCart.js

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,069
    Thanks
    44
    Thanked 3,216 Times in 3,178 Posts
    Blog Entries
    12

    Default

    Well OK, there's nothing jumping out at me. I do see that simpleCart has:

    Code:
    window.onload = simpleCart.initialize;
    If magnify has anything similar in an on page script you haven't shown, or requires an onload event in the body tag of the page(s) using it, there would be a conflict there. Can you give me a link to a page where the two scripts are 'not playing well together'?

    In any case though, I'd try this first - change (in simpleCart.js - at the end):

    Code:
    window.onload = simpleCart.initialize;
    to:

    Code:
    if (window.addEventListener)
     window.addEventListener('load', simpleCart.initialize, false);
    else if (window.attachEvent)
     window.attachEvent('onload', simpleCart.initialize);
    If it's an onload conflict with magnify, this will resolve it.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. The Following User Says Thank You to jscheuer1 For This Useful Post:

    alinart (11-06-2009)

  6. #5
    Join Date
    Nov 2009
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    that didn't fix it unfortunately

    This is one of the test pages
    http://artiztic.net/yoga/item1.html

    You can see the simpleCart.js works fine if you click on the Weightloss or Yogasports is Green tabs.

    Also, on item pages without magnify.js such as http://artiztic.net/yoga/sport_pack.html

    item1.html has magnfy.js and simpleCart.js on it

    I appreciate your help.

  7. #6
    Join Date
    Nov 2009
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Nevermind it's working! had to empty my cookies. That change fixed it. Thank you so much!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •