Second update: Looks like one of my functions (resetFigures) was preventing the event handler,so moving that to the end of the bind function sorted it out.
Update: I realized after some basic testing that the click events were registering,it’s just that the Box fails to flip when tapped.
我有我的网站在Chrome和Firefox的基本审美功能,但它拒绝在iOS上正常运行(测试在iPhone 4与iOS 6.1和iPad与iOS 4.3.5)。
你可以在这里查看网站和脚本(main.js):http://bos.rggwebdesigns.com/
我读过iOS没有真正地处理jQuery点击事件,但我正在努力找出一个修复。 Stack Overflow上的几个线程提到了live()方法,但实现它像下面(以及添加onclick =“”到可点击的元素)似乎没有工作:
$('.card').live('click touchstart',function() { var figure = $(this).children('.back'); var button = figure.find('.button'); var column = $(this).parents().eq(1); $('.column').removeAttr('style'); column.css('z-index',2000); resetFigures(); if(flipCard(this)){ swoosh.pause(); swoosh.currentTime = 0; swoosh.play(); } });
我也遇到了这个有趣的解决方案项目:http://aanandprasad.com/articles/jquery-tappable/。
然而,我没有运气这两者:
$('.card').tappable(function() { var figure = $(this).children('.back'); var button = figure.find('.button'); var column = $(this).parents().eq(1); $('.column').removeAttr('style'); column.css('z-index',2000); resetFigures(); if(flipCard(this)){ swoosh.pause(); swoosh.currentTime = 0; swoosh.play(); } });
此外,如果我误导,请纠正我,但根据这个网站,3D变换在iOS中支持相应的前缀:http://caniuse.com/transforms3d
解决方法
而PPK有这个建议:http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
我发现这个容易修复,只需添加到css:
cursor: pointer;