2012-05-31 2 views
0

J'utilise le code ci-dessous pour animer le texte continuellement encore et encore mais le code ci-dessous se termine par 10 cas que j'ai mentionné dans le code ci-dessous mais j'ai exigé que le texte soit animé et encore.Comment répéter l'animation de texte continuellement encore et encore

<html lang="en"> 
    <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <title>jQuery TextFX - A jQuery Text Animation Engine</title> 
    <style type="text/css"> 
    body{margin:0;padding:0;color:#333}#effectTwo{display:none} 
    </style> 
    <link rel="stylesheet" type="text/css" href="cj-text-fx.min.css" /> 
    <script src="jquery-1.6.1.min.js" type="text/javascript"></script> 
    <script type="text/javascript">jQuery.noConflict();</script> 
    <script src="jquery.easing.1.3.min.js" type="text/javascript"></script> 
    <script src="cj-text-fx.min.js" type="text/javascript"></script> 
    <script type="text/javascript"> 
    var isOn = 0, 
sets, fx, toAnimate = "#effect", 
settings = { 
    animation: 8, 
    animationType: "in", 
    backwards: !1, 
    easing: "easeOutQuint", 
    speed: 1E3, 
    sequenceDelay: 100, 
    startDelay: 0, 
    offsetX: 100, 
    offsetY: 50, 
    onComplete: fireThis, 
    restoreHTML: !0 
}; 
jQuery(document).ready(function() { 
    fx = jQuery("#effect"); 
    jQuery.cjTextFx(settings); 
    jQuery.cjTextFx.animate(toAnimate) 
}); 

function fireThis() { 
    if (isOn !== 13) { 
     isOn < 13 ? isOn++ : isOn = 0; 
     switch (isOn) { 
     case 1: 
      sets = { 
       animationType: "out", 
       restoreHTML: !1 
      }; 
      break; 
     case 2: 
      fx.html("Systematic Approch for Innovation"); 
      sets = { 
       animation: 11 
      }; 
      break; 
     case 3: 
      sets = { 
       animation: 11, 
       animationType: "out", 
       restoreHTML: !1 
      }; 
      break; 
     case 4: 
      fx.html("Systematic Approch for Innovation"); 
      sets = { 
       animation: 1 
      }; 
      break; 
     case 5: 
      sets = { 
       animation: 1, 
       animationType: "out", 
       restoreHTML: !1 
      }; 
      break; 
     case 6: 
      fx.html("Systematic Approch for Innovation"); 
      sets = { 
       animation: 6, 
       backwards: !0 
      }; 
      break; 
     case 7: 
      sets = { 
       animation: 4, 
       animationType: "out", 
       backwards: !0, 
       restoreHTML: !1 
      }; 
      break; 
     case 8: 
      fx.html("Systematic Approch for Innovation"); 
      sets = { 
       animation: 2, 
       easing: "easeOutBounce" 
      }; 
      break; 
     case 9: 
      sets = { 
       animation: 2, 
       animationType: "out", 
       speed: 500, 
       easing: "easeInBack", 
       restoreHTML: !1 
      }; 
      break; 
     case 10: 
      fx.html("Systematic Approch for Innovation"), sets = { 
       animation: 14, 
       startDelay: 1E3, 
       linked: !0, 
       hyperlink: "generator.html", 
       color: "#0000FF", 
       linkTarget: "_self", 
       onComplete: null 
      } 
     } 
     jQuery.cjTextFx.animate(toAnimate, sets) 
    } 
}; 

    </script> 
    </head> 
    <body> 
    <div id="container"> 
    <div id="text-fx"> 
    <div id="effect">Systematic Approch for Innovation</div> 
    </div> 
    </div> 
    </body> 
    </html> 

S'il vous plaît montrez-moi un moyen de résoudre le problème. c'est urgent. Merci d'avance.

+1

Pourquoi pas de format le code perfec tly?: D –

+0

Sérieusement, avez-vous balayé ceci du site de quelqu'un d'autre et maintenant vous voulez l'utiliser comme le vôtre après avoir changé une variable, mais vous ne savez pas lequel changer? Honnêtement, je ne peux pas penser à une autre raison pour laquelle vous publieriez du code minifié (!) Que vous auriez «urgemment» besoin d'aide pour le modifier. Très peu. Si vous allez dérober le code de quelqu'un d'autre, faites au moins un minimum d'efforts pour l'amener à faire ce que vous voulez qu'il fasse, afin que vous puissiez honnêtement prétendre que vous l'utilisez comme exemple pour apprendre . > :-( –

Répondre

0

Change:

if (isOn !== 13) { 
isOn < 13 ? isOn++ : isOn = 0; 

et

case 10: 
     fx.html("Systematic Approch for Innovation"), sets = { 
      animation: 14, 
      startDelay: 1E3, 
      linked: !0, 
      hyperlink: "generator.html", 
      color: "#0000FF", 
      linkTarget: "_self", 
      onComplete: null 
     } 
    } 
    jQuery.cjTextFx.animate(toAnimate, sets) 

Pour:

isOn !== 11 ? isOn++ : isOn = 0; 

et

case 10: 
     fx.html("Systematic Approch for Innovation"), sets = { 
      animation: 14, 
      startDelay: 1E3, 
      linked: !0, 
      hyperlink: "generator.html", 
      color: "#0000FF", 
      linkTarget: "_self", 
      onComplete: function(){ 
       jQuery.cjTextFx.animate(toAnimate, sets) 
      } 
     } 
    } 
Questions connexes