我只是在单击特定按钮时切换类,当用户单击外部文档时我想删除该类。如果我将事件更改为在桌面上单击并测试但在iPad上似乎没有发生任何事情。任何人都可以就如何使这项工作提出任何建议吗?
$shoppingIcon.on('click', function(e) {
var $this = $(this);
$this.prev($productInfo).toggleClass('active');
});
$(document).on('touchstart', function() {
$productInfo.removeClass('active');
});