I added a click event to some pricing tables so they apply animation class for mobile devices. It works but everytime I am on iphone and I click pricing option it flashes the screen before it applies the class, is there a way to get rid of this?
To see flash please view on iphone or mobile device located here: http://codepen.io/bskousen/pen/ijqBo
Your code makes no sense
$(".box").click(function(){
$(this).parent().addClass("circle");
}).click(function(){
$(this).parent().removeClass("circle");
});
You are basically doing this
$(".box").click(function(){
$(this).parent().addClass("circle");
$(this).parent().removeClass("circle");
});
If you want to toggle a class with multiple clicks, you should use toggleClass()
$(".box").click(function(){
$(this).parent().toggleClass("circle");
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.