jquery-show()-显示和隐藏

来源:互联网 发布:ubuntu 没有文件夹权限 编辑:程序博客网 时间:2024/06/11 03:41
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>显示和隐藏</title><script src="../jquery/jquery-1.7.1.js"></script><script>$(document).ready(function (){//利用toggle方法实现显示和隐藏$('#btn0').toggle(function (){//先隐藏掉$('p').hide('slow');},function(){//再显示出来$('p').show('slow');});//利用toggle方法实现淡入淡出$('#btn1').toggle(function (){//先隐藏掉$('p').fadeIn('slow');},function(){//再显示出来$('p').fadeOut('slow');});$('#btn1').toggle(function (){//先隐藏掉$('img').fadeIn('slow');},function(){//再显示出来$('img').fadeOut('slow');});$('#btn2').toggle(function (){//先隐藏掉$('img').fadeTo('slow',0.66);},function(){//再显示出来$('img').fadeTo('slow',0.22);});});</script></head><body><p>我是李楠!!</p><p>我是李楠!!</p><p>我是李楠!!</p><img width="200px" height="200px" src="file:///D|/Program Files/wamp/www/2012/jQuery/images/12926034201734018.jpg"><input type="button" id="btn0" value="显示/隐藏" /><input type="button" id="btn1" value="淡入/淡出" /><input type="button" id="btn2" value="淡入/淡出 效果 透明度0.66" /></body></html>