Wordpress 归档 - 如何只处理 class 的一个元素用于 jquery 动画?

Wordpress archive - how to handle just one element of a class for jquery animation?

我在 wordpress 网站上有一个简单的动画角。这在首页上工作正常,但在 archive 页面上,所有元素都会出现相同的动画,而不仅仅是当前元素。代码是:

//animacja zagiętych rogów
        $(".pad-fix", this).hover(function() {
            console.log('ok');
            $(this).find('.hand').animate({
                borderWidth: "12.5px"
            }, 400);
            $(this).find('.wiecej').animate({
                right: "27px"
            }, 400);
        }, function() {

            $(this).find('.hand').animate({
                borderWidth: "7.5px"
            }, 400);
            $(this).find('.wiecej').animate({
                right: "22px"
            }, 400);
        });

我怎样才能将动画缩减到只有一个。

当您将鼠标悬停在一篇文章上时,您会在 .pad-fix 元素上触发 hover 事件,该元素似乎是 all 文章的父级页面。这基本上意味着 $(this) == $('.pad-fix') 在事件处理程序上下文中。因此,脚本试图在 .pad-fix 内找到 all .hand 元素,而不是在悬停的单个 .pad-fix article 内。尝试将您的 hover 事件绑定到 .pad-fix article.pad-fix .dl_lead.