实例讲解Jquery中隐藏hide、显示show、切换toggle的用法
本文实例为大家分享了jquery中show()、hide()和toggle()用法实例,供大家参考,具体内容如下
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>初识jQuery</title> <script src="http:/www.gimoo.net/jquery/1.9.0/jquery.js" type="text/javascript"></script> <!--引用这个jquery库--> <style> #test{ display:none; width:120px; height:50px; border:1px solid blue; } </style> </head> <body> <div id="test">Hello world!</div> <!--设置三个按钮,每次点击调用特定的函数--> <button onclick="sayHello()">点我打开!</button> <button onclick="sayGoodbye()">点我关闭!</button> <button onclick="change()">点我切换!</button> <script type="text/javascript"> function sayHello(){ $("#test").show(5000); <!--设参数5000,表示用5000ms的时间完成这个动作--> } function sayGoodbye(){ $("#test").hide(); <!--不设置,默认速度--> } function change(){ $("#test").toggle("slow"); <!--设置以slow的速度打开--> } </script> </body> </html>
效果图:
以上就是本文的全部内容,希望对大家学习jquery程序设计有所帮助。
jQuery基于扩展实现的倒计时效果
本文实例讲述了jQuery基于扩展实现的倒计时效果。分享给大家供大家参考,具体如下:divid="fnTimeCountDown"data-end=""spanclass="mini"00/span分spanclass="sec"00/span秒s
jQuery基于$.ajax设置移动端click超时处理方法
本文实例讲述了jQuery基于$.ajax设置移动端click超时处理方法。分享给大家供大家参考,具体如下:这里介绍jqueryclick事件如何在移动端自动转换成touchstart
jquery动态切换背景图片的简单实现方法
本文实例讲述了jquery动态切换背景图片的简单实现方法。分享给大家供大家参考,具体如下:(function(){varbgCounter=0,backgrounds=["Images/BACKGROUND_1_TEST.png","Image
编辑:广州明生医药有限公司
标签:实例,本文,给大家,方法,讲述了