Javascript中的简单隐藏和淡入淡出
Simple Hide and Fade In Javascript
当用户悬停在div"item"时,文本(h1)Share This将被隐藏,div将被显示,我想知道是否有人能帮我做一个简单的隐藏和淡入淡出。一旦用户离开项目div,它将自动隐藏div social btn并显示h1。
这是代码:
<div class="item">
<h1 class="socialh1">Share This!</h1>
<div class="social-btn">
<div class="Fb-btn">
Facebook button here!
</div>
<div class="twitter-btn">
twitter button here!
</div>
</div>
</div>
点击此处查看实际操作:
http://jsfiddle.net/A9WpU/
谢谢!!!
尝试以下操作:
$('.item').hover(function(){
$('h1.socialh1').hide('fast');
$('div.social-btn').show('fast');
},function(){
$('div.social-btn').hide('fast');
$('h1.socialh1').show('fast');
});
演示
$(function(){
$('.item').hover(function() {
$('.socialh1').fadeOut('fast');
$('.social-btn').fadeIn('fast');
}, function() {
$('.socialh1').fadeIn('fast');
$('.social-btn').fadeOut('fast');
});
});
在这里,检查这个小提琴:
http://jsfiddle.net/A9WpU/4/
我认为
var sbtn = $('.social-btn');
$('h1.socialh1').hover(function(){
sbtn.show();
},function(){
var timer = setTimeout(function(){
sbtn.hide();
}, 200);
sbtn.data('hidertimer', timer);
});
sbtn.hover(function(){
clearTimeout(sbtn.data('hidertimer'))
}, function(){
sbtn.hide();
})
演示:Fiddle
使用JQuery悬停:
$(".item").hover(
function () {
$(this).find(".socialh1").fadeOut();
$(this).find(".social-btn").fadeIn();
},
function () {
$(this).find("social-btn").fadeOut();
$(this).find(".socialh1").fadeIn();
});
Fiddle
相关文章:
- Javascript将图像src更改为淡入淡出
- css(或jQuery)悬停时淡入淡出
- 将淡入淡出添加到“我的身体背景滑块”
- 多重潜水淡入淡出打开
- 添加/删除类淡入淡出不起作用
- 带有计数器、缩略图、进度条和淡入淡出效果的简单jQuery幻灯片
- 使用jquery淡入淡出
- 淡入淡出脚本不起作用
- 具有淡入淡出效果的全背景图像
- jQuery滑块淡入淡出
- 在淡入淡出之间淡入淡出
- jQuery idTabs-使用鼠标悬停自动更改和淡入淡出
- 文本淡入淡出后循环加载页面
- 文本淡入淡出jquery
- 动画文本淡入淡出
- 如何添加淡入淡出效果
- (阅读更多链接)到模式淡入淡出视图
- 单击“淡入淡出”按钮
- JQuery刷新列表效果-淡入淡出问题
- 如何使部分在滚动中淡入淡出