本文介绍了简单淡入淡出淡出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');在此处查看: jsfiddle/3XwZv/57/
更多推荐
简单淡入淡出淡出div,点击jquery
发布评论