jQuery调用WebMethod(PageMethod) NET2.0的方法
404
2024-03-07
1.toggle
切换对象的隐藏和显示,可以用来代替show和hide
<!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> <style type="text/css"> #div1 { width:200px; height:200px; background-color:red; border:1px black solid; clear:both; } #btn,#info { float:left; } #info { margin-bottom:20px; } </style> <script type="text/javascript" src="http://www.gimoo.net/t/1812/jQuery/jquery-1.12.1.js"></script> <script type="text/javascript"> $(function(){ $("#btn").click(function(){ var msg1; var msg2; if($("#div1").css("display")=="none") { msg1="正在显示..."; msg2="显示完毕!"; } else { msg1="正在隐藏..."; msg2="隐藏完毕!"; } $("#info").html(msg1); $("#div1").toggle(4000,function(){ $("#info").html(msg2); }); }); }); </script> </head> <body> <input type="button" value="变换" id="btn" /> <div id="info">1</div> <div id="div1"></div> </body> </html>
2.fadeIn fadeOut
fadeIn 淡入(本来是隐藏的),fadeOut 淡出(本来是显示的)
fadeOut
淡出的时候 这一块的空间就会被隐藏 而下方的模块会往上移动
<!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> <style type="text/css"> #div1 { width:200px; height:200px; background-color:red; border:1px black solid; clear:both; } #btn,#info { float:left; } #info { margin-bottom:20px; } </style> <script type="text/javascript" src="http://www.gimoo.net/t/1812/jQuery/jquery-1.12.1.js"></script> <script type="text/javascript"> $(function(){ $("#btn").click(function(){ $("#div1").fadeOut(4000); }); }); </script> </head> <body> <input type="button" value="变换" id="btn" /> <div id="info"></div> <div id="div1"></div> </body> </html>
fadeIn
<!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> <style type="text/css"> #div1 { width:200px; height:200px; background-color:red; border:1px black solid; clear:both; } #btn,#info { float:left; } #info { margin-bottom:20px; } </style> <script type="text/javascript" src="http://www.gimoo.net/t/1812/jQuery/jquery-1.12.1.js"></script> <script type="text/javascript"> $(function(){ $("#div1").css("display","none"); $("#btn").click(function(){ $("#div1").fadeIn(4000); }); }); </script> </head> <body> <input type="button" value="变换" id="btn" /> <div id="info"></div> <div id="div1"></div> </body> </html>
3.fadeTo
切换到一个指定的透明度:0表示彻底透明,1表示不透明。
<!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> <style type="text/css"> #div1 { width:200px; height:200px; background-color:red; border:1px black solid; clear:both; } #btn,#info { float:left; } #info { margin-bottom:20px; } </style> <script type="text/javascript" src="http://www.gimoo.net/t/1812/jQuery/jquery-1.12.1.js"></script> <script type="text/javascript"> $(function(){ $("#btn").click(function(){ $("#div1").fadeTo(4000,0.1); }); }); </script> </head> <body> <input type="button" value="变换" id="btn" /> <div id="info"></div> <div id="div1"></div> </body> </html>
4.slideUp和slideDown
slideUp:向上滑动隐藏对象
slideDown:向下滑动显示对象(说明本来是隐藏的)
slideUp
<!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> <style type="text/css"> #div1 { width:200px; height:200px; background-color:red; border:1px black solid; clear:both; } #btn,#info { float:left; } #info { margin-bottom:20px; } </style> <script type="text/javascript" src="http://www.gimoo.net/t/1812/jQuery/jquery-1.12.1.js"></script> <script type="text/javascript"> $(function(){ $("#btn").click(function(){ $("#div1").slideUp(4000); }); }); </script> </head> <body> <input type="button" value="变换" id="btn" /> <div id="info"></div> <div id="div1"></div> </body> </html>
slideDown
<!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> <style type="text/css"> #div1 { width:200px; height:200px; background-color:red; border:1px black solid; clear:both; } #btn,#info { float:left; } #info { margin-bottom:20px; } </style> <script type="text/javascript" src="http://www.gimoo.net/t/1812/jQuery/jquery-1.12.1.js"></script> <script type="text/javascript"> $(function(){ $("#div1").css("display","none"); $("#btn").click(function(){ $("#div1").slideDown(4000); }); }); </script> </head> <body> <input type="button" value="变换" id="btn" /> <div id="info"></div> <div id="div1"></div> </body> </html>
5.slideToggle
滑动实现对象的隐藏与显示切换
<!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> <style type="text/css"> #div1 { width:200px; height:200px; background-color:red; border:1px black solid; clear:both; } #btn,#info { float:left; } #info { margin-bottom:20px; } </style> <script type="text/javascript" src="http://www.gimoo.net/t/1812/jQuery/jquery-1.12.1.js"></script> <script type="text/javascript"> $(function(){ $("#btn").click(function(){ $("#div1").slideToggle(4000); }); }); </script> </head> <body> <input type="button" value="变换" id="btn" /> <div id="info"></div> <div id="div1"></div> </body> </html>
以上这篇JQuery实现DIV其他动画效果的简单实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持绿夏网。
#免责声明#
本站[绿夏技术导航]提供的一切软件、教程和内容信息仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络收集整理,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑或手机中彻底删除上述内容。如果您喜欢该程序或内容,请支持正版,购买注册,得到更好的正版服务。我们非常重视版权问题,如有侵权请邮件[admin@lxwl520.com]与我们联系进行删除处理。敬请谅解!