jQuery Effect - Effet Puff

La description

le Puffl'effet peut être utilisé avec afficher / masquer / basculer. Cela crée un effet bouffant en agrandissant l'élément et en le masquant en même temps.

Syntaxe

Voici la syntaxe simple pour utiliser cet effet -

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

Paramètres

Voici la description de tous les arguments -

  • mode- Le mode de l'effet. Peut être "afficher" ou "masquer". La valeur par défaut est hide.

  • percent- Le pourcentage à mettre à l'échelle. La valeur par défaut est 150.

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( "puff", { }, 2000 );
            });

            $("#show").click(function(){
               $(".target").show( "puff", {percent:100}, 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