Effet jQuery - Effet de clip

La description

le Clipl'effet peut être utilisé avec afficher / masquer / basculer. Cela coupe l'élément en marche ou en arrêt, verticalement ou horizontalement.

Syntaxe

Voici la syntaxe simple pour utiliser cet effet -

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

Paramètres

Voici la description de tous les arguments -

  • direction- La direction de l'effet. Peut être "vertical" ou "horizontal". La valeur par défaut est verticale.

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

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( "clip", {direction: "horizontal"}, 1000 );
            });

            $("#show").click(function(){
               $(".target").show( "clip", {direction: "vertical"}, 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>

Cela produira le résultat suivant -

jquery-effects.htm