在点击jquery上添加类时屏幕闪烁

时间:2014-01-23 16:04:28

标签: javascript jquery css iphone

我在某些定价表中添加了点击事件,因此他们为移动设备应用了动画类。它的工作原理,但每次我在iphone上点击定价选项它会在应用课程之前闪烁屏幕,有没有办法摆脱这个?

要查看闪光灯,请在位于此处的iphone或移动设备上查看:http://codepen.io/bskousen/pen/ijqBo

1 个答案:

答案 0 :(得分:1)

你的代码毫无意义

$(".box").click(function(){
   $(this).parent().addClass("circle");

  }).click(function(){
       $(this).parent().removeClass("circle");
});

你基本上是这样做的

$(".box").click(function(){
   $(this).parent().addClass("circle");
   $(this).parent().removeClass("circle");
});

如果您想通过多次点击切换课程,则应使用toggleClass()

$(".box").click(function(){
   $(this).parent().toggleClass("circle");
});
相关问题