jquery - 元素的不透明度

标签 jquery css opacity

我正在尝试通过 jQuery 设置元素的不透明度。

$('[class*="OtherFeatur"]').load(function(){
                    $(this).fadeTo(500, 0.5);
                });

不工作,但当我工作时

                $('[class*="OtherFeatur"]').fadeTo(0,0.5);
它会受到影响。第一个代码的问题在哪里? 哪个更好,通过 jQuery 或 CSS 设置不透明度? 我怎样才能通过 css 做到所有浏览器都可以显示它?

最佳答案

如果你只想设置元素的不透明度,那么使用css方法。

 $('[class*="OtherFeatur"]').css("opacity", 0.5);

关于jquery - 元素的不透明度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7349738/

相关文章:

javascript - 我希望用户在我的 &lt;textarea&gt; 中看到换行符而不是 <br>

javascript - JQUERY - 单击后将 CSS 类添加到 BUTTON 元素

html - 如何添加图像来替换按钮中的字体象形图

css - 我可以合并 :nth-child() or :nth-of-type() with an arbitrary selector? 吗

html - 使 CSS 背景图像变暗

jQuery 鼠标悬停鼠标悬停不透明度

html - 如何修复 Bootstrap 不透明度?

javascript - JQuery:向所有 child 添加点击事件,不起作用

javascript - 知道在 php 循环中点击了哪一行

html - 缩略图显示全尺寸