我试图让这个导航栏响应移动游猎。它在iPhone模拟器上工作正常。 从这个答案认为它只需添加游标:指针属性,但仍然没有运气。 How do I use jQuery for click event in iPhone web application 任何帮助非常感谢(代码在桌面浏览器上正常工作)
$(document).ready(function(){
//Click nav links
$('.nav li').click(function(e){
$('.nav li').attr('id', ''); //navtabs inactive
$(this).attr('id', 'activetab'); // clicked tab active
//hide fieldsets
$('fieldset').attr('class', 'hidden');
whichitem=$(this).attr('title'); //get title nav clicked
//show class cleared
$("fieldset[title='"+whichitem+"']").attr('class', '');
});
});
和表格:
<div class="nav">
<ul>
<li id="activetab" title="<?php echo _('Login'); ?>"><?php echo _('Step 1'); ?></li>
<li title="<?php echo _('Professional Details'); ?>"><?php echo _('Step 2'); ?></li>
<li title="<?php echo _('Optional'); ?>"><?php echo _('Step 3'); ?></li>
</ul>
</div>
<button type="submit"><?php echo _('Submit'); ?></button>
</fieldset>
</form>
答案 0 :(得分:1)
:)修正了
$(document).ready(function(){
var ua = navigator.userAgent,
event = (ua.match(/iPhone/i)) ? "touchstart" : "click";