jQuery 中的 Explode方法函数

首页 / jQuery入门教程 / jQuery 中的 Explode方法函数

爆炸效果可以与show/hide/toggle一起使用。这会将元素爆炸或分解为许多碎片。

Explode - 语法

selector.hide|show|toggle( "explode", {arguments}, speed );

这是所有参数的描述-

Explode - 示例

以下是一个简单的示例,简单说明了此效果的用法-

<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( "explode", {pieces: 16 }, 2000 );
            });

            $("#show").click(function(){
               $(".target").show( "explode", {pieces: 16}, 2000 );
            });
				
         });
			
      </script>
		
      <style>
         p {background-color:#bca; width:200px; border:1px solid green;}
         div{width:100px; height:100px; background:red;}
      </style>
   </head>
	
   <body>
      <p>Click on any of the buttons</p>
		
      <button id="hide"> Hide </button>
      <button id="show"> Show</button> 
  
      <div class="target">
      </div>
   </body>
</html>

这将产生以下输出-

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

Linux性能优化实战 -〔倪朋飞〕

OpenResty从入门到实战 -〔温铭〕

ZooKeeper实战与源码剖析 -〔么敬国〕

检索技术核心20讲 -〔陈东〕

视觉笔记入门课 -〔高伟〕

技术管理案例课 -〔许健〕

跟着高手学复盘 -〔张鹏〕

Web 3.0入局攻略 -〔郭大治〕

AI大模型企业应用实战 -〔蔡超〕

好记忆不如烂笔头。留下您的足迹吧 :)