首页 > 解决方案 > 区分要在jquery中使用的h1标签

问题描述

我有两个带有内容标题第二个标题的h1 标签

我的问题是使用 jquery 时both the h1 tags get activated

want the Second heading only to be used in jquery。我如何实现它?

 function animateText() {
            TweenMax.from($('h1'), 0.8, {
                scale: 0.4,
                opacity: 0,
                rotation: 15,
                ease: Back.easeOut.config(4),
            });
        }
<h1 >Heading</h1>

<h1 >second heading</h1>

标签: jqueryhtml

解决方案


您可以将 id 标签添加到元素:

<h1 id="not_using">Heading</h1>

<h1 id="use_this_one">second heading</h1>

然后通过他们的 id 来识别他们。


推荐阅读