我正在使用flip jquery 的插件。我想翻转一张卡片(div),翻转完成后,立即恢复翻转。我就是这么尝试的
$("#flipbox").bind("hover",function(){
$(this).flip({
direction:'tb',
onEnd: function() {
$(this).revertFlip();
console.log('when the animation has already ended');
}
})
}
最佳答案
试试这个:http://jsfiddle.net/netwire88/NAbZT/16/
$(document).on("click", ".flipbox-forward", function(e) {
e.preventDefault();
var $this = $(this);
$this.flip({
direction: $this.data("direction"),
color: $this.data("color"),
content: $this.data("title"),
onBefore: function() {
$this.removeClass('flipbox-forward');
$this.addClass('flipbox-revert');
}
})
});
$(document).on("click", ".flipbox-revert", function(e) {
e.preventDefault();
var $this = $(this);
$this.revertFlip();
$this.removeClass('flipbox-revert');
$this.addClass('flipbox-forward');
});
关于jquery - 我需要在悬停时翻转 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8310597/