简单淡入淡出淡出div,点击jquery

编程入门 行业动态 更新时间:2024-10-25 16:28:12
本文介绍了简单淡入淡出淡出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

本文发布于:2023-11-11 07:59:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1577826.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:简单   div   jquery

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!