2015-08-19 9 views
0
var clickCount = 0; 

$(".arrowRight").click(function() { 
    clickCount++; 

    if (clickCount >= 3) { 
     clickCount = 0; 
     $(".arrowRight").removeClass("active"); 
     $(".arrowRight").addClass("disable"); 
    } 
    else { 
     $(".arrowRight").removeClass("disable"); // this is the line that isnt working 
     $(".arrowRight").addClass("active"); // but this works 
    } 
}); 

一切與上述一起使用,直到我'disable'類。它增加了3次點擊後,但想法是點擊重置後的第三次,以及提示else,甚至'active'被正確添加(例如在其他內容後第3點擊重置 - disable類不會刪除!從CSS需要類不按預期與刪除點擊計數器

刪除此行從CSS類

.disable { 
     pointer-events: none; 
     cursor: default; 
} 
+0

你可以做一個小提琴? – smnbbrv

回答