开发者

function within function not working

I have the following script:

$('li.cat-hider').click(function () {
    var activeID = $(this).attr('id');
    if ($('li#' + activeID).hasClass('hidethis')) {
        $('img.t-' + activeID).toggleClass('hidden', function () {
            alert('ok');
        });
        $(this).toggleClass('hidethis');
        $('img.t-' + activeID).slideToggle('slow');
    } else {
        $(this).toggleClass('hidethis');
        $('img.t-' + activeID).toggleClass('hidden').s开发者_StackOverflowlideToggle('slow');
    }
});

The alert doesn't occur. Everything else toggles and works fine. I can't understand why the alert won't happen. Can someone please point out to me where I'm going wrong?

MTIA!


ToggleClass has no callback. See the docs. You shouldn't need one either because the class toggle occurs instantly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜