【问题标题】:Jquery hover event stuck on clone elementsJquery悬停事件卡在克隆元素上
【发布时间】:2015-05-18 16:22:10
【问题描述】:

我正在为投资组合项目创建一个带有 wordpress 的插件。一切正常。但问题是当我应用过滤器时,悬停效果停止对克隆项目起作用 也可以JS FIDDLE

jquery 代码在下面我试过了

/* Scroll to Top Button */
jQuery(document).ready(function() {

    // Animate Box Shadow on some elements
    // Add the overlay. We don't need it in HTML so we create it here



    // Clone portfolio items to get a second collection for Quicksand plugin
    var $portfolioClone = jQuery(".rudra-portfolio").clone(true);

    // Attempt to call Quicksand on every click event handler
    jQuery(".rudra-portfolio-filter a").click(function(e) {

        jQuery(".rudra-portfolio-filter li").removeClass("current");

        // Get the class attribute value of the clicked link
        var $filterClass = jQuery(this).parent().attr("class");

        if ($filterClass == "all") {
            var $filteredPortfolio = $portfolioClone.find("li");
        } else {
            var $filteredPortfolio = $portfolioClone.find("li[data-type~=" + $filterClass + "]");
        }

        // Call quicksand
        jQuery("ul.rudra-portfolio").quicksand($filteredPortfolio, {
            duration: 500,
            easing: 'easeInOutQuad'
        });

        jQuery(this).parent().addClass("current");

        // Prevent the browser jump to the link anchor
        e.preventDefault();
    })
    jQuery(".port-li").click(function() {

            jQuery(this).find('.content-wrapper').slideDown();
    });

    jQuery(".overeffect").mouseover(function() {
        jQuery(this).find('.content-wrapper').slideDown();

    });



    jQuery("#portfolio-grid li").mouseleave(function() {
        jQuery('.content-wrapper').slideUp(500);

    });

});

小时效果在第一次和第二次都可以正常工作,但之后就停止工作了。

更新

我也试过这个Jquery clone

【问题讨论】:

  • 试试on('hover',function(){});
  • 不工作,我的悬停功能工作,检查问题中的js小提琴链接
  • 这给了你一个线索而不是确切的答案,哇,你自己解决了,对你很好。

标签: javascript jquery quicksand


【解决方案1】:

由我解决..

我只需要使用这个

jQuery(document).on('hover',".overeffect",function(){

     jQuery(this).find('.content-wrapper').slideDown();     
        });

【讨论】:

    猜你喜欢
    • 2011-12-20
    • 1970-01-01
    • 1970-01-01
    • 2021-12-31
    • 2011-10-21
    • 1970-01-01
    • 2011-04-23
    • 1970-01-01
    • 2011-06-02
    相关资源
    最近更新 更多