Accordian, Values, onComplete, and Bug Fixes!

Posted on by

This is the total amount of fixes and new features that have come out in the past week, or so. I’ll be adding more info concerning them to the docs very soon.

New Demo:

New Features:

  • empty() – you can remove all child nodes of an element.
    // Deletes the contents of all DIV elements
    $("div").empty();
  • is(Expression) – tests to see if the matched elements matches that expression. Is equivalent to: $().filter(Expression).size() > 0.
    // Tests to see if a DIV has a class of test
    if ( $("div").is(".test") ) {
      alert( "test div found!" );
    }
  • html() – If you provide no parameter to the html() method it will return the innerHTML of the first element.
    // Copy the HTML contents into a Textarea
    $("textarea").val( $("#block").html() );
  • val() – Same as the html() method, but for the value parameter (if an argument is provided, it sets the value, no parameter – returns the first value).
    // Copy a value from one input to another
    $("input#hidden").val( $("input#name").val() );
  • $.postXML() and $.getXML – For the AJAX plugin, same as $.post() and $.get(), but forcefully try to get the returned XML, regardless of the Content-Type.
    // Get the XML contents of a file
    $.getXML("file.xml",function(xml){
      $(xml).find("title") // ...
    });
  • A new ‘normal’ speed (400ms) for animations was added.
    // Slide a DIV in at normal speed
    $("div").slideDown("normal");
  • Setting an onComplete handler for animations is much easier now.
    $("div").show("slow",function(){
      alert("all done!");
    });

Bug Fixes:

  • Opera and the AJAX plugin now play nicely together.
  • A problem with appending text nodes was resolved.
  • Handling for IE and the AJAX plugin was optomized.
  • A problem with #id expressions retreiving by tag was fixed.
  • A fix for removing classes that have dashes in them was implemented.
  • A bug with binding events to dynamically created HTML was fixed.
  • A bug with show() not revealing elements that have a display of none, by default, was fixed.
  • Another Prototype 1.3 and jQuery bug was resolved.
  • The mangling of the overflow attribute, by the animations, was resolved.
  • and finally: The infamous height/width auto animation bug has been resolved!

16 thoughts on “Accordian, Values, onComplete, and Bug Fixes!

  1. Though I do like jQuery very much, I’ll have to stick to moofx (and prototype-lite.)
    moofx has “builtin checks that won’t let a user break the effect with multiple crazy clicks” that jQuery does not. (They also know how to spell “Accordion”.)

    It is easy to ‘break’ the jQuery Accordion (and the toggle function) with “multiple crazy clicks.” I know it’s all in the event handling and the effects part of jQuery, but do not want to hack any scripts so as to keep upgrading easy.

    Cheers.

  2. Hi Nick – Thanks for the spelling catch, it’s been fixed. The “crazy clicks” bug is definitely a known issue and I’m working to resolve it now. I’ll be sure to contact you once it’s been completely resolved. Generally speaking, simply sending an email to the mailing list, or to me personally, will get your problem attended to right away.

  3. I am trying to use the slideDown and slideUp functions (like the examples in the web site above). The slideUp function works, but the slideDown function does not. This function doesn’t work on the demo site and I can’t seem to make it work on my site either. Any suggestions.

    ron

  4. Hi Ron, I’m having trouble duplicating the bug that you mentioned. What browser are you using? If you’re referring to the demo on Cody’s site, then the slideDown function only works after you’ve already hit the slideUp button. Let me know if this helps.

  5. Actually, I fixed the problem. I used the latest.js from his website and apparently this is a bug in that particular version. I installed the latest version (from your download) and it works.

    But, I have a new issue. I am having trouble with the following code:
    //Code for example B
    $(“input.Bslide”).click(function()
    {
    $(“div.contentToChange”)
    .find(“p.fourthparagraph:visible”)
    .slideUp(“slow”)
    .end()
    .find(“p.fourthparagraph:hidden”)
    .slideDown(“slow”)
    .end();
    });

    It is called by: response.write “”

    The above code will slideUp and then slideDown and then slideUp and then freeze. It is very repeatable. Any suggestions ??? I want to toggle the action of slideUp and slideDown from a single button based on whether the text is visible or not visible.

    Thanks in advance.

  6. Thanks. That helped a lot. It is now working. But, if I click before the slideUp or slideDown action has finished, it becomes confused and stops working. I want to use this function on a production quality web site. Is there a way to prevent click-happy users from confusing the code ???

  7. Giuliano Marcangelo on said:

    Have utilised the example accordion code donated by Frank Marcia on a test site, and have one small problem, inasmuch that the the accordion effect does not work on the first page load and all the separate components of the accordion are separated.

    Navigating to another page and then returning to the “accordion” page, makes the effect work very smoothly.

    It is most probably another script interfering with jquery code, will investigate and report back.

    John, Frank, Lindley………et al……..many many thanks for sharing……….this is a truly stupendous library……….so easy for a non coder like myself to implement…….

  8. Thanks again for the quick response. I appreciate you helping me thru this. I now find that the code is working on IE and NS on the PC and Safari on MAC/OSX. But, is not working on IE 5.2 for the MAC/OSX ???

    Can you be so kind as to help me once more…

  9. Ron: Unfortunately, jQuery doesn’t support IE 5.* for Mac. Considering that neither Apple, Yahoo, or even Microsoft support that browser anymore, I’d recommend considering deprecating its use.

  10. Thanks again for all of the help. One of the difficulties of having a public site is that I don’t get to choose the browsers used to visit the site. I make browser recommendations. But right now, there are a high percentage of MAC users browsing the site with IE 5+. The site is focused towards older less technical people. I want to install your functions in a few critical areas and I can’t afford to have those currently working functions suddenly stop working. You have a great concept and I will check back in the future. Thanks again for the help.

  11. David on said:

    Ron-
    I wasn’t aware that there are older, less technical people that actually use IE on a Mac :) If I were you I’d promise to pay for their next bingo night if they switched from IE to a browser that is actually supported by a company.

  12. Теперь придется попробовать сделать как вы написали, жаль что пока кризис не закончиться не будет возможности это сделать