Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: jQuery 1.2.x breaks all JS

  1. #1
    Join Date
    Dec 2008
    Location
    Moscow, Russia
    Posts
    21
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default jQuery 1.2.x breaks all JS

    1) Script Title:
    Animated Collapsible DIV (2.1)

    2) Script URL (on DD):
    http://www.dynamicdrive.com/dynamici...edcollapse.htm

    3) Describe problem:
    The problem is that jQuery 1.2.x destroys all the functionality of every script on my page. It has a lot of javascripts that are all essential. I've pinned the problem on jQuery. Even the collapsible div script is broken. It's an interactive page, but nothing is clickable with jQuery linked to it. When I remove the jQuery link, everything else works.

    Thanks in advance!

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Sounds like a conflict with another library like prototype or mootools.

    Please post a link to the page on your site that contains the problematic code so we can check it out.
    - John
    ________________________

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

  3. #3
    Join Date
    Dec 2008
    Location
    Moscow, Russia
    Posts
    21
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    I don't use any other Javascript libraries; just jQuery. And it breaks all of my interactive scripts.

    Unfortunately, I have not acquired hosting for this site yet. For the moment, it's just a fun thing.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Well you can try running jQuery in no-conflict mode. Place it as the first script on your page, make the animatedcollapse.js script the second. At the top of animatedcollapse.js, make it like so:

    Code:
    //** Animated Collapsible DIV v2.0- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com.
    //** May 24th, 08'- Script rewritten and updated to 2.0.
    //** June 4th, 08'- Version 2.01: Bug fix to work with jquery 1.2.6 (which changed the way attr() behaves).
    
    var animatedcollapse;
    (function($){
    animatedcollapse={
    divholders: {}, //structure: {div.id, div.attrs, div.$divref}
    divgroups: {}, //structure: {groupname.count, groupname.lastactivedivid}
    lastactiveingroup: {}, //structure: {lastactivediv.id}
    and at the end:

    Code:
    setCookie:function(name, value, days){
    	if (typeof days!="undefined"){ //if set persistent cookie
    		var expireDate = new Date()
    		expireDate.setDate(expireDate.getDate()+days)
    		document.cookie = name+"="+value+"; path=/; expires="+expireDate.toGMTString()
    	}
    	else //else if this is a session only cookie
    		document.cookie = name+"="+value+"; path=/"
    }
    
    }
    })(jQuery);
    - 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:

    MoscowModder (02-18-2009)

  6. #5
    Join Date
    Dec 2008
    Location
    Moscow, Russia
    Posts
    21
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    (Edit: I misspelled the jquery.js file link and now that it's changed, the original problem is back.)

    Well, re-arranging the scripts ends the script-breaking, but animatedcollapse doesn't work.

    Without the changes to animatedcollapse.js, Firebug gives me this error:
    $divref is null
    {path}/js/animatedcollapse.js
    Line 42

    With the changes you described:
    animatedcollapse is undefined
    javascript:animatedcollapse.show(4);
    Line 1

    What's wrong now?

    By the way, all of the javascript files are in a /js/ folder from index.html
    Last edited by MoscowModder; 02-10-2009 at 02:45 PM.

  7. #6
    Join Date
    Dec 2008
    Location
    Moscow, Russia
    Posts
    21
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Turns out I misspelled the filename of jQuery-1.2.6.pack.js. I fixed that and the original problem returned. Now what?

  8. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Can you get the Animated Collapsible DIV v2.01 script to run on a page with only its scripts and jQuery on it? If not, you either have a bad copy of jQuery or are doing something else wrong.

    If it's not simply a bad copy of jQuery, I'd really need to see a demo of the problem. Make one and upload it to the web, post the address to it here.
    - John
    ________________________

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

  9. #8
    Join Date
    Dec 2008
    Location
    Moscow, Russia
    Posts
    21
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    I know it worked before, and then it inexplicably stopped working. I've downloaded and re-downloaded both animatedcollapse.js and jquery-1.2.6.pack.js multiple times. I'll try making a new page to see if it works.

  10. #9
    Join Date
    Dec 2008
    Location
    Moscow, Russia
    Posts
    21
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    How odd. The demo page works perfectly with the same scripts!

  11. #10
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Sort of like a case of going to the doctor and suddenly feeling better. Can you copy your live page as local and will it work? Are you getting any error messages or warnings locally?
    - John
    ________________________

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

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
  •