jQuery悬停事件停留在克隆元素上 [英] Jquery hover event stuck on clone elements

查看:96
本文介绍了jQuery悬停事件停留在克隆元素上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am creating an plugin with wordpress for the portfolio items. 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

我尝试过的下面给出了jQuery代码

the jquery code is given below i tried

/* 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 .

更新

我也尝试过 jQuery克隆

推荐答案

由我解决了..

我只需要使用

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

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

这篇关于jQuery悬停事件停留在克隆元素上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆