Monday, November 30, 2009

[jQuery] slideToggle Functions

I have a simple bit of jQuery that I just can't get working.

$('#my-element').click(function(){
$('#list-element').slideToggle(function(){
$('#status-element').html('show artist index');
console.log('show');
},function(){
$('#status-element').html('hide artist index');
console.log('hide');
}
);
});

Right? Simple? I've had it working before, but whenever the element is
clicked, the element toggles but the console prints 'hide' every time
and the #status-element never gets changed. I have also tried just
using toggle() instead of slideToggle and also

slideToggle(200,function(){...

(including the speed before the callback functions).

Any ideas would be appreciated!

Thanks,
Gavin

No comments: