admin管理员组文章数量:1416050
I'm curious how .fadeTo()
fades an element? Does it use an inline style of opacity to do this?
And if it does not use css opacity, then how would you control css opacity using jQuery or javascript?
This question is referring to all of the following:
.fadeTo()
.fadeIn()
.fadeOut()
I'm curious how .fadeTo()
fades an element? Does it use an inline style of opacity to do this?
And if it does not use css opacity, then how would you control css opacity using jQuery or javascript?
This question is referring to all of the following:
.fadeTo()
.fadeIn()
.fadeOut()
Share
Improve this question
asked Sep 12, 2011 at 2:13
stefmikhailstefmikhail
7,15513 gold badges49 silver badges61 bronze badges
1
- 1 Even though browsers implement opacity differently, all browsers implement it. So it's a matter of detecting and implmenting the correct type for the browser/version, not a matter of it being inline/block level attributes. – Jared Farrish Commented Sep 12, 2011 at 2:17
2 Answers
Reset to default 8From the jQuery source - CSS opacity.
fadeTo: function( speed, to, easing, callback ) {
return this.filter(":hidden").css("opacity", 0).show().end()
.animate({opacity: to}, speed, easing, callback);
It does use CSS opacity!
Check out the source code here: http://code.jquery./jquery-latest.js
And search for fadeTo
.
You will see (as of today, anyway):
fadeTo: function( speed, to, easing, callback ) {
return this.filter(":hidden").css("opacity", 0).show().end()
.animate({opacity: to}, speed, easing, callback);
},
本文标签: javascriptHow does jQuery fadeTo() workStack Overflow
版权声明:本文标题:javascript - How does jQuery .fadeTo() work? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745244930a2649512.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论