我需要帮助,我一直在努力让这个工作......:
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();
});
谢谢
答案 0 :(得分: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');
}