放置效果可与show/hide/toggle一起使用。这将删除该元素,或者通过将其放入来显示该元素。
selector.hide|show|toggle( "drop", {arguments}, speed );
下面是对所有参数-的描述
direction - 方向. 可以为 "left", "right", "up", "down". 默认为: left.
mode - 模式,可以为 "show" or "hide". 默认为: hide.
下面是一个简单的示例,一个简单的示例显示了此效果-的用法
<html> <head> <title>The jQuery Example</title> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"> </script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"> </script> <script type="text/javascript" language="javascript"> $(document).ready(function() { $("#hide").click(function(){ $(".target").hide( "drop", {direction: "up"}, 1000 ); }); $("#show").click(function(){ $(".target").show( "drop", {direction: "down"}, 1000 ); }); }); </script> <style> p {background-color:#bca; width:200px; border:1px solid green;} </style> </head> <body> <p>Click on any of the buttons</p> <button id="hide"> Hide </button> <button id="show"> Show</button> <div class="target"> <img src="../images/jquery.jpg" alt="jQuery" /> </div> </body> </html>
这将产生以下输出-
链接:https://www.learnfk.comhttps://www.learnfk.com/jquery/effect-drop.html
来源:LearnFk无涯教程网
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)