L'exemple de cet article décrit l'utilisation de jQuery pour créer des animations à l'aide d'animate. Partagez-le avec tout le monde pour votre référence. Les détails sont les suivants :
Utilisation de l'animation :
animate( Paramètres de hachage, String|NumberJavascript chaîne ou vitesse de valeur numérique, String easing, Function callback (facultatif) Fonction à exécuter lorsque l'animation est terminée) Fonction utilisée pour créer des animations personnalisées.
La capture d'écran de l'effet d'exécution de l'instance est la suivante :

Le code spécifique est le suivant :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
<html xmlns= "http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv= "Content-Type" content= "text/html; charset=utf-8" />
<title>animate</title>
<script type= "text/javascript" src= "jquery-1.6.2.min.js" ></script>
<script type= "text/javascript" >
$(document).ready( function (){
$( "a" ).toggle( function (){
$( ".stuff" ).animate({ height: 'hide' , opacity: 'hide' }, 'slow' );
}, function (){
$( ".stuff" ).animate({ height: 'show' , opacity: 'show' }, 'slow' );
});
});
</script>
</head>
<body>
<a href= "#" >text</a>
<div class = "stuff" >
animate( Hash params, String|NumberJavascript 字符串或数字值 speed, String easing , Function callback(可选) 在动画完成时执行的函数 )
用于创建自定义动画的函数。</div>
</body>
</html>
|
Copier après la connexion
J'espère que cet article sera utile à la conception de la programmation jquery de chacun.