简体   繁体   English

jQuery悬停事件停留在克隆元素上

[英]Jquery hover event stuck on clone elements

I am creating an plugin with wordpress for the portfolio items. 我正在使用wordpress为投资组合项目创建一个插件。 Everything works fine . 一切正常。 But the issue is when i apply the filter the hover effect stopped working on the cloned items also available JS FIDDLE 但是问题是当我应用过滤器时,悬停效果停止在克隆项目上也起作用JS FIDDLE

the jquery code is given below i tried 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);

    });

});

hour effect is working fine for first and second time , but after that it stopped working . 小时效果第一次和第二次都可以正常工作,但是之后停止了。

Update 更新资料

I also tried this Jquery clone 我也尝试过这个jQuery克隆

solved by me .. 被我解决了..

i just need to use this 我只需要使用这个

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM