jquery - 我需要在悬停时翻转 div

标签 jquery

我正在使用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/

相关文章:

Jquery:对一个 .click 事件使用两个选择器?

javascript - 从数组中动态选择对象

javascript - 如何使用 Javascript 触发附加到 DOM 的元素上的 CSS3 转换?

javascript - jQuery $.ajax 成功触发最后

jquery - grails gorm:格式化的数字和日期

javascript - 需要帮助将 jQuery 对象转回字符串

javascript - .replacewith 每 30 秒

javascript - 将列表转换为小于 480 像素的选择框(包括其 anchor )

Javascript 多维数组/哈希表

javascript - 通过单击相关选项卡渲染多个局部 View