元素的不透明度
我正在尝试通过 jQuery 设置元素的不透明度。
$('[class*="OtherFeatur"]').load(function(){
$(this).fadeTo(500, 0.5);
});
不工作,但当我工作时
$('[class*="OtherFeatur"]').fadeTo(0,0.5);
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?I'm trying to set opacity of element by jQuery.
$('[class*="OtherFeatur"]').load(function(){
$(this).fadeTo(500, 0.5);
});
is not working but when I do
$('[class*="OtherFeatur"]').fadeTo(0,0.5);
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您只想设置元素的不透明度,请使用 css 方法。
If you want to just set the
opacity
of element then usecss
method.动画需要长于 0 毫秒,
您可以使用:
如果我没有误解 jquery 已经扩展了 CSS 上的不透明度规则,因此它适用于所有浏览器。
An animation need to be longer then 0ms
you can just use:
if Im not mistaking jquery has extended the opacity rule on the CSS so it applies on all browsers.
.load()
- 从服务器加载数据并将返回的 HTML 放入匹配的元素中。因此此函数适用于将数据从另一个资源加载到您选择的元素。
可能您需要页面加载事件:
或者如果您加载一些数据,请首先在
.load()
方法中指定源。在这种情况下,函数将在加载内容后被调用。
.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:
or if you loads some data, specify the source first in the
.load()
method.in this case function will be invoked after loading the content.
你正在寻找的是
what you are looking for is