SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Addict Sgt. Baboon's Avatar
    Join Date
    Dec 2002
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with Scriptaculous and other JS

    A site I am working on uses Scriptaculous for a menu effect. It works great. However, whenever I add another Javascript to the page, it breaks. At first I thought it was an onLoad conflict, but then realized it conflicts with any JS I add. Whenever I add more JS to the page, the menu effect doesn't work, but the new JS always does.

    Does anyone have any ideas? I originally thought I just needed to load the Scriptaculous onLoad, which I can't figure out, but now I think it is deeper than that.

    I can provide any files or code that you may need.

    Thanks!

  2. #2
    SitePoint Evangelist bradical1379's Avatar
    Join Date
    Feb 2007
    Posts
    443
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you post up the other javascript that you feel is conflicting?

    If there is conflicts, I assume its with the prototype javascript, not with the scriptaculous.

  3. #3
    SitePoint Addict Sgt. Baboon's Avatar
    Join Date
    Dec 2002
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I sure will. In the meantime, I added a lightbox to one of the pages and it they both work fine.

  4. #4
    SitePoint Addict Sgt. Baboon's Avatar
    Join Date
    Dec 2002
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok here is an example. It is an image tooltip script. The .js file is attached. Below is the code in the html that calls it.

    Code:
    onmouseover="doTooltip(event,1)" onmouseout="hideTip()"
    Thanks!
    Attached Files Attached Files

  5. #5
    SitePoint Addict Sgt. Baboon's Avatar
    Join Date
    Dec 2002
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, unless someone has an idea, it looks as though I will need to use a different menu. Another page utilizes a gallery type script that also uses Scriptaculous, and they of course conflict too.

  6. #6
    SitePoint Zealot chrisdpucci's Avatar
    Join Date
    Dec 2006
    Location
    On the internets
    Posts
    191
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are the other scripts you use based on a different framework such as Jquery? If so, yeah they are not compatible and you'll have to decide to use one or the other. If it's just standard transparent javascript, unless you've created a function with the same name as one of the functions in your framework, there shouldn't be any conflicts.

  7. #7
    SitePoint Addict Sgt. Baboon's Avatar
    Join Date
    Dec 2002
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Chris.

    I know one uses the same, so that one is obvious. The other I am having problem with I am still trying to figure out. That is the one attached to this thread. It doesn't seem to use any such framework.

    I admit though, I am no expert at JS.

  8. #8
    SitePoint Addict Sgt. Baboon's Avatar
    Join Date
    Dec 2002
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What about 2 scripts that both use Scriptaculous? How do I get them to play nicely on the same page?

  9. #9
    SitePoint Zealot
    Join Date
    Sep 2007
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    just a thought after skimming your code, might not help though:

    imagetooltip.js LINE 98 try changing

    window.onload = initTip;

    TO

    Event.observe(window, 'load', initTip, false);

  10. #10
    SitePoint Addict Sgt. Baboon's Avatar
    Join Date
    Dec 2002
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by gimbles View Post
    just a thought after skimming your code, might not help though:

    imagetooltip.js LINE 98 try changing

    window.onload = initTip;

    TO

    Event.observe(window, 'load', initTip, false);
    Thanks gimbles. That did help. They now both work. Now if I can just get 2 Scriptaculous scripts working together, all would be well!

  11. #11
    SitePoint Addict Sgt. Baboon's Avatar
    Join Date
    Dec 2002
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually, I got that working too. I had included the prototype.js and scriptaculous.js twice. Changed that and both work now.

    Thanks for the help!


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
  •