简单淡入淡出淡出div,点击jquery [英] Simple fade in fade out div with jquery on click
本文介绍了简单淡入淡出淡出div,点击jquery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
此处的代码,你可以在这里阅读答案 - 我编辑这个以供将来参考。
THIS CODE UNDER HERE WORKS, you can read the answers under here - i edit this for future reference.
HTML :
<div><a href="#" id="btn">Show bank div and hide fancy div</a></div>
<div id="btn-bk"><a href="#">back</a></div>
<div id="bank">Bank Div</div>
<div id="fancy">Fancy Div</div>
CSS :
#bank {display:none;}
#btn-bk {display:none;}
Javascript :
$('#btn').click(function(e){
$('#fancy, #btn').fadeOut('slow', function(){
$('#bank, #btn-bk').fadeIn('slow');
});
});
$('#btn-bk').click(function(e){
$('#bank, #btn-bk').fadeOut('slow', function(){
$('#fancy, #btn').fadeIn('slow');
});
});
推荐答案
你的问题在于这行代码:
Your problem is with this line of code:
$('#bank').replace('<div id="fancy"></div>').fadeIn('slow');
jQuery中没有.replace()函数。删除它,它的工作原理:
There is no .replace() function in jQuery. Remove that and it works:
$('#bank').fadeIn('slow');
在此处查看: http://jsfiddle.net/3XwZv/57/
这篇关于简单淡入淡出淡出div,点击jquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文