SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    May 2010
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up multiple JavaScript clashing

    hi guys,

    im not amazing with javascript and could do with some advice.

    anyways ive tried putting two different scripts on my page and they clash. Ive read up about it (http://www.javascriptkit.com/javatut...plejava3.shtml)
    and i can understand it, but just can't apply the solution to my scripts.

    ive put my site online at http://www.design-wright.co.uk/nmr/home.html

    theres a slide show which is currently working, and a scrolling box at the bottom which is currently dead.

    i would love a nudge in the right direction....

    thanks for your time.

    alsweet

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by alsweet View Post
    i would love a nudge in the right direction....
    One of your scripts use jQuery.noConflict() which removes $ from the global namespace.

    Your news.js script can recreate the $ object by passing jQuery to the function, which will use it as $ inside the function.

    Here's the construct that you would want to use:

    Code javascript:
     jQuery(function($) {
        ...
    })(jQuery);

    The jQuery.noConflict() page shows similar example code. In their example code, note that the .ready() snippet is nowdays superseded by jQuery callback
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Member
    Join Date
    May 2010
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    awesome!
    thanking you kindly


Tags for this Thread

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
  •