ndugger
ndugger

Reputation: 7531

Why won't this work with jQuery 1.9?

So, I wrote a small bit of jquery to toggle a side-bar on my web app, and it works just fine in jQuery 1.8, but once I upgraded to 1.9, it broke. Here is the code:

$('a#sidebar-act').toggle(function() {
    $('div#sidebar').animate({width:260}, 200);
}, function() {
    $('div#sidebar').animate({width:64}, 200);
})

Upvotes: 1

Views: 114

Answers (1)

Joseph Silber
Joseph Silber

Reputation: 220136

This functionality of the toggle method has been removed. You'll have to track the toggle yourself:

var alternateMethod = false;

$('a#sidebar-act').click(function() {

    $('div#sidebar').animate({
        width: alternateMethod ? 64 : 260
    }, 200);

    alternateMethod = ! alternateMethod;
});

Upvotes: 3

Related Questions