元素的不透明度 [英] opacity of element

查看:113
本文介绍了元素的不透明度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to set opacity of element by jQuery.

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

无效,但当我

                $('[class*="OtherFeatur"]').fadeTo(0,0.5);


它将受到影响。其中是第一个代码的问题?
和哪一个更好,通过jQuery或CSS设置不透明度?

it will be affected. where is problem of first code? and which one is better ,set opacity by jQuery or CSS? how can I do it by css ,that all browser can show it?

推荐答案


如何通过css做所有浏览器可以显示它? .load()
- 从服务器加载数据并将返回的HTML放入匹配的元素。

.load() - Load data from the server and place the returned HTML into the matched element.

此函数用于将数据从另一个资源加载到您选择的元素。

So this function works for loading data from the another resource to the element you selected.

可能需要页面加载事件:

probably you need page load event:

$(document).ready(function() {
   $('[class*="OtherFeatur"]').fadeTo(0,0.5);
});

或如果加载某些数据,请先在 .load ()方法。

or if you loads some data, specify the source first in the .load() method.

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

在这种情况下,函数将在加载内容后调用。

in this case function will be invoked after loading the content.

这篇关于元素的不透明度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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