
Untitled
By: a guest on
Jun 14th, 2012 | syntax:
JavaScript | size: 1.20 KB | hits: 16 | expires: Never
Q: I have a function, and want to animate a div element via css a transition (should look like a flipbox). How could i implement that the click function is not queued, so that you cannot "spam" the flipbox? Should there be a extra if statement or something similar?
JQUERY:
$(document).ready(function() {
function flipBack() {
console.log($(this));
var $this=$(this);
$this.removeClass('flip');
$this.children('.front').delay(600).show(0);
$this.children('.back').delay(600).hide(0);
return false;
}
function flipForward() {
var $this = $(this);
$this.addClass('flip');
$this.children('.front').delay(600).hide(0);
$this.children('.back').delay(600).show(0);
var t=setTimeout(function () {
$this.trigger("click");
},2000);
}
$('.click').toggle(flipForward, flipBack);
});
I tried to get things done with this, but i failed :)
$el.click(function(){
if( !clickban ){
clickban = true;
// Do something, and then afterwards set clickban to false
// and then you can click again.
}
});