jquery中hide、show、slideUp、slideDown、animate应用
2012-11-09 00:00
435 查看
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>jquery_slip.html</title><!--一个标签写错网页什么也不显示,查看网页源码格式明显不对--> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("div.show").click(function(){ $("div.content").slideToggle("slow");//不写默认为normal,后面函数一致 // $("div.show").slideUp(); }); }); </script> <script type="text/javascript"> //注意选择标签不能忘记加"",否则动作不起作用 $(document).ready(function(){ //hide and show function test $("#hide_button").click(function(){ $("#hide_show_content").hide("slow",function(){ alert("The content is hided."); }); }); $("#show_button").click(function(){ $("#hide_show_content").show("slow",function(){ alert("The content is showed."); }); }); //slideUp and slideDown function test $("button.slideUp").click(function(){ $("p.slide_content").slideUp("slow"); }); $("button.slideDown").click(function(){ $("p.slide_content").slideDown("slow"); }); //animate and reset test $("button#animate").click(function(){//可以直接用标签名调用id $("#box").animate({height:"30px"}); }); $("#reset").click(function(){ $("#box").animate({height:"10px"}); }); //html application,其中可以加入内容页可以直接加入html标签内容 $(".html").click(function(){ $(".htmlContent").html("The html content."); }); $(".htmlreset").click(function(){ $(".htmlContent").html("html application into jquery."); }); $(".htmlappend").click(function(){ $(".htmlContent").append("append content."); }); $(".htmlafter").click(function(){ $(".htmlContent").after("after content."); //这里不能直接用函数 // $("html.after").after(function(){ // alert("You have add content after html content."); // }); }); $(this).click(function(){//也可以直接用this $(".htmlContent").before("before content",function(){ alert("You have add content before html content."); }); }); $(".htmlprepend").click(function(){ $(".htmlContent").prepend("html prepend content."); }); }); </script> </head> <body> <div class="content"> <p>We are friends.</p> <p>We can do everything if you want. Do it by yourself.</p> <p>Don't tell it can not be done.</p> </div> <div class="show"> <p>click here to show content.</p> </div> <br> <div id="hide_show"> <p id="hide_show_content">There is the function hide and show test.</p> <button type="button" id="hide_button">hide</button> <button type="button" id="show_button">show</button> </div> <br> <div> <p class="slide_content">There is the function slipUp and slipDown test.</p> <button class="slideUp" type="button" >slideUp</button> <button class="slideDown" type="button">slideDown</button> </div> <br> <div id="box" style="background:#EF23E1;height=10px;width=10px;margin=6px;"></div> <button id="animate" type="button">animate</button> <button id="reset" type="button">reset</button> <br> <div> <p class="htmlContent">html application into jquery.</p> <button type="button" class="html">htmltest</button> <button type="button" class="htmlreset">htmlreset</button> <button type="button" class="htmlappend">htmlappend</button> <button type="button" class="htmlafter">htmlafter</button> <button type="button" class="htmlbefore">htmlbefore</button> <button type="button" class="htmlprepend">htmlprepend</button> </div> </body> </html>
相关文章推荐
- jQuery学习21---简单动画效果,show,hide,slideUp,slideDown,fadeOut,fadeIn
- jQuery 动画特效show() hide() slideUp() slideDown() fadeIn() fadeOut() animate() stop() delay()
- jquery 显示隐藏div方法show(),hide(),toggle(),slideDown()总结
- jQuery中的slideUp()、slideDown()、hide()、show()
- jQuery动画animate使用show hide toggle
- jQuery中的slideUp()、slideDown()、hide()、show()
- jquery的hide(),show(),fastIn(),fastOut(),slideUp(),slideDown()的使用
- jquery 显示隐藏div方法show(),hide(),toggle(),slideDown()总结
- jQuery中的slideUp()、slideDown()、hide()、show() 的比较
- jquery 显示隐藏div方法show(),hide(),toggle(),slideDown()总结
- jQuery-动画 animate() hide() show() toggle() fadeT0() slideToggle()
- jquery复习笔记1 - ready() show() hide() toggle()
- jquery插件之图片show and hide(一)
- jQuery笔记1 — hide、show、toggle、css、选择器
- jquery实战1-hide与show
- 仿JQuery的show与hide动画函数
- jQuery中animate的应用(图片自动移动)
- 用js模拟JQuery的show与hide动画函数代码
- jQuery动画-让页面动起来! (2)基本的动画函数主要分为show, hide和toggle
- Css的display与JQuery的show()、hide(),displayjquery