[英]Fade in / Fade out with hover function
Hi I would like to implement a Fade in / Fade out effect on my hover, How Can I do this cause I need to keep position of cursor for Text Displayed. 嗨,我想在我的悬停上实现淡入/淡出效果,该如何执行此操作,因为我需要为显示的文本保持光标位置。
http://jsfiddle.net/u3pW8/34/ http://jsfiddle.net/u3pW8/34/
$(function() {
$("#static .wrapper").hover(function (e) {
var parentOffset = $(this).parent().offset();
var relX = e.pageX - parentOffset.left;
$(this).children(".hidden-content").css("left", relX);
});
});
Thx for help ! 谢谢!
Use CSS3 transition: 使用CSS3过渡:
.hidden-content {
position: absolute;
opacity:0;
display:block;
transition: opacity 0.2s ease;
}
.wrapper:hover .hidden-content {
opacity:1;
}
I have made some changes to your code. 我对您的代码进行了一些更改。 This should work.
这应该工作。 I added this line among other things:
我在其他内容中添加了这一行:
$(this).children(".hidden-content").fadeIn('slow');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.