-1

我需要帮助,我一直在努力让它工作......:

btnMenu.on('click', function(e) {
    var $this = $(this);

    $this.addClass('selected');

    if(menu.is(':visible')) {
        alert('visible'); // This works
        $this.removeClass('selected'); // This doesnt work in safari mobile but works everywhere else.
    }

    menu.stop().slideToggle(500, 'easeInOutQuint');

    e.preventDefault();
});

谢谢

4

1 回答 1

0

如何不先添加“选定”而使用其他?

if(menu.is(':visible')) {
    alert('visible'); // This works
    $this.removeClass('selected'); // This doesnt work in safari mobile but works everywhere else.
} else {
    $this.addClass('selected');
}

甚至,根据您的代码;

if(!menu.is(':visible')) {
    $this.addClass('selected');
}
于 2013-09-30T23:36:33.433 回答