所以,我有以下jquery:
jQuery('.button').click(function(e) {
var isMobiles = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ? true : false;
if(!isMobiles) {
jQuery('.button').featherlight(); //lightbox function
alert("desktop");
}else{
alert("mobile");
}
})
在桌面视图中,我收到提醒"桌面"和羽毛灯箱。
在移动设备视图中,我仍然收到了羽毛灯箱和警报" mobile"。
当我得到" mobile"提醒?
有什么建议吗?
答案 0 :(得分:1)
您发布的代码绝对不会这样做。
试试这个:
$._data( $('.button')[0], "events" );
以查看附加到该元素的事件
我们采用第一个.button
,因为它们都应该附加相同的事件.featherlight()