JQUERY/CSS iPad问题:为什么双击需要选择单选按钮?
所以我有一个问题,我在菜单项上显示一个div,上面有几个单选按钮JQUERY/CSS iPad问题:为什么双击需要选择单选按钮?,jquery,ios,css,Jquery,Ios,Css,所以我有一个问题,我在菜单项上显示一个div,上面有几个单选按钮 我的问题:在iPad和iphone上,我需要点击单选按钮两次,直到它们被选中。(在桌面上没有问题) 我的问题:我如何做到用户只需点击一次 代码: (a) 下面是显示该菜单的代码: // when entering/leaving the popup, show/hide it slide.on('mouseenter', function() { $(this).css('d
(a) 下面是显示该菜单的代码:
// when entering/leaving the popup, show/hide it
slide.on('mouseenter', function() {
$(this).css('display', 'block');
})
slide.on('mouseleave', function() {
$(this).css('display', 'none').removeClass('open');
})
// check if filter is applied and add active icon
$('div.slide > fieldset > input').on('click', function() {
if ($(this).hasClass('color_input')) {
color_kleider.addClass('color_active');
}
})
(b) 另一个代码是将单击绑定到单选按钮上:
// when entering/leaving the popup, show/hide it
slide.on('mouseenter', function() {
$(this).css('display', 'block');
})
slide.on('mouseleave', function() {
$(this).css('display', 'none').removeClass('open');
})
// check if filter is applied and add active icon
$('div.slide > fieldset > input').on('click', function() {
if ($(this).hasClass('color_input')) {
color_kleider.addClass('color_active');
}
})
(a) 请访问live网站:
(b) 请看这里的图片:
我相信你的第一次触摸是激活了
鼠标输入事件,你的第二次点击实际上是激活了点击事件
在您的情况下,我认为您不需要触摸设备上的mouseenter
事件,但第一次点击应该仍然激活下方的click
事件。您可以将this.stoppropigation()
添加到幻灯片的鼠标指针处理程序中,并查看单击是否在第一次点击时注册
我还要注意的是,mouseleave
在下一个事件注册之前不会在iOS上启动,就像在触摸界面中一样,“光标”会保留在您上次触摸屏幕的位置,直到它出现在另一个位置
理想情况下,您应该这样写,以便触摸设备不会记录任何悬停事件。什么是('
?对于ipad,您可能应该使用,而不是-只是开玩笑;)好的,我单击也不起作用。。。你知道怎么不用敲两下吗?