Is it possible to Call one function after click on body then call different function after the second click?
i tried and then stopped, any ideas?
$("html, body").one("click",function() {
// to something
}
You could try something like this:
var clicks = 0;
$("html, body").on("click",function() {
if(clicks === 0){
funcA();
}
if(clicks > 1){
funcB();
}
clicks++;
}
Where funcA and func
Edit: I changed my answer due to your latest addition to your question. See this snippet:
var myFunctions = [];
myFunctions.push(function() {
$("body").css("background-color", "red");
});
myFunctions.push(function() {
$("body").css("background-color", "green");
});
$("html, body").click(function(){
if(myFunctions.length > 0) myFunctions.shift()();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>