tags:

views:

25

answers:

1

I use the following code to collapse/show divs in my content page:

$(document).ready(function() {
// Hookup event handlers and execute HTML DOM-related code
$('#nameHyperLink').click(function() {

        var div = $('#nameDiv');
        var link = $('#nameHyperLink');
        if (div.css('display') == 'none') {
            link.text('Hide Data');
            div.show('100');
        }
        else {
            link.text('Show Data');
            div.hide('100');
        }

    });
});

When I include the jquery UI script file, this code no longer works. The text for the hyperlink changes, but the div is not actually displayed.

Why is this?

+1  A: 

I think what you're seeing here is a result of the removal/change of some code in jQuery UI 1.8. Previously, and still in core, any unrecognized string passed to hide/show defaults to the "normal" speed.

For more details, you can see a similar question here: http://stackoverflow.com/questions/2578204/jquery-1-4-2-is-foo-hidenormal-broken-or-am-i-crazy

Nick Craver
Ah, the good ole' days. Back when jQuery was.... the same as it is now.
karim79
@karim79 I haven't tested, is this still broken in 1.8.1 released the other day?
Nick Craver
@Nick, I don't know. I changed all `hide("normal")`s to `slideUp()`, plus I was unaware of the update!
karim79
@karim79 - Still broken :( http://jsfiddle.net/LjKy4/ This was *really* a crap move by whoever committed that change.
Nick Craver
@Nick - That's insane. At this rate we're going to have to develop a show/hide compatibility patch.
karim79