Effet jQuery - Méthode Explode ()

La description

le Explodel'effet peut être utilisé avec afficher / masquer / basculer. Cela explose ou implose l'élément dans / à partir de nombreuses pièces.

Syntaxe

Voici la syntaxe simple pour utiliser cet effet -

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

Paramètres

Voici la description de tous les arguments -

  • pieces - Nombre de pièces à exploser / à imploser.

  • mode- Le mode de l'animation. Peut être réglé sur "afficher" ou "masquer".

Exemple

Voici un exemple simple montrant l'utilisation de cet effet -

<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>

Cela produira le résultat suivant -

jquery-effects.htm