SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Dec 2011
    Posts
    221
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    two js conflict due to onload event at the same time.

    Greetings!! I'm new in js..I've searched that js cannot perform two onload event at the same time. I've got two sets of codes here
    from

    http://ajax.googleapis.com/ajax/libs.../jquery.min.js and
    http://code.jquery.com/jquery-1.6.3.min.js

    and here is the the problem

    else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);
    and
    else if(c.attachEvent){c.attachEvent("onreadystatechange",C),a.attachEvent("onload",e.ready);
    is there any way to get rid from error? any help would be appreciated. Thanks!

  2. #2
    SitePoint Addict sdleihssirhc's Avatar
    Join Date
    Feb 2009
    Posts
    387
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I might have misunderstood the question, but there shouldn't actually be an error. In both cases, it looks like the scripts are using the "attachEvent" method for IE6-8.

    That method attaches an event listener, and there's no restriction on how many listeners you can add to an element for any one event (even "onload").

    Further reading: JavaScript - Traditional event registration model

    ...Also, why are you loading two different versions of jQuery?
    Last edited by sdleihssirhc; Dec 6, 2011 at 13:55. Reason: wait what
    I'm the web overlord for Graphic Business Systems

  3. #3
    Under Construction silver trophybronze trophy AussieJohn's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    776
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Do you perhaps have a sample page up somewhere?

    Since that code is from the jQuery library, I would suggest removing the extra library definition and that ought to fix it. (Even so, I don't believe you should be getting this error as whatever that latest copy of jQuery is that you included should overwrite the previous copy.)

    Try removing the extra one and see how you go.
    var details = {
    . . web: "afterlight.com.au",
    . . photos: "jvdl.id.au",
    . . psa: "usethelatestversion.com"
    }

  4. #4
    SitePoint Addict
    Join Date
    Dec 2011
    Posts
    221
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    I'm new in Javascript, and I just downloaded the two tutorials from this site, I want to combine the two animation
    at the same time but the bubble navigation doesn't work properly. I searched for the solution but it says that it cant work since
    there is two onload event at the same time.

    Hope I'm making myself clear and right.

    http://tympanus.net/codrops/2010/04/...n-with-jquery/
    http://tutorialzine.com/2011/09/shuf...effect-jquery/

  5. #5
    Under Construction silver trophybronze trophy AussieJohn's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    776
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    You should just be able to include the code in the following order:

    - jQuery Library
    - jQuery Shuffle Letters plugin
    - Code for Shuffling letters + Code for bubble navigation

    Do you have an example page where your error is occurring? It might help give a better insight as to what is happening.
    var details = {
    . . web: "afterlight.com.au",
    . . photos: "jvdl.id.au",
    . . psa: "usethelatestversion.com"
    }

  6. #6
    SitePoint Addict
    Join Date
    Dec 2011
    Posts
    221
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    <!-- The JavaScript -->
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
    <script type="text/javascript" src="jquery.easing.1.3.js"></script>

    <script src="http://code.jquery.com/jquery-1.6.3.min.js"></script>
    <script src="jquery.shuffleLetters.js"></script>
    <script src="script.js"></script>
    The first two are the scripts for bubble navigation
    the latter are scripts for the shuffle letters.

  7. #7
    Under Construction silver trophybronze trophy AussieJohn's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    776
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by claro View Post
    The first two are the scripts for bubble navigation
    the latter are scripts for the shuffle letters.
    Code:
    <script src="http://code.jquery.com/jquery-1.6.3.min.js"></script>
    Leave that one out, it's overwriting the first library and the easing plugin.

    You only ever have to include the jQuery library once per page.
    var details = {
    . . web: "afterlight.com.au",
    . . photos: "jvdl.id.au",
    . . psa: "usethelatestversion.com"
    }


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
  •