[firefox] modifier un paramètre à script js

Boukachaka -  
 Utilisateur anonyme -
Salut, j'ai ce script qui fonctionne bien, par contre, je voudrai en modifier un paramètre pour optimiser l'affichage sous firefox : passer le letter-spacing à 0.1em;

Quelqu'un pourrait m'aider à inclure un test de navigateur et modifier le retour ?

<SCRIPT LANGUAGE="JavaScript">
var theText2 = "ecnadnet";
function nextSize2(i,textLength) {
return (20*Math.abs( Math.sin(i/(textLength/3.14)))+10);
}
function sizeCycle2(text2,dis2) {
zob2 = ""
for(i = text2.length; i > (-1) ; i--) {
size2 = parseInt(nextSize2(i +dis2,text2.length));
zob2 += "<font color='#910025' style='font-size: "+ size2 +"pt; letter-spacing: 0.3em;'>" +text2.substring(i,i+1)+ "</font>";
}
document.getElementById("theDiv2").innerHTML = zob2;
}
function doWave2(n) {
sizeCycle2(theText2,n)
if (n > theText2.length) {n=0}
tempowave2 = setTimeout("doWave2(" + (n+1) + ")", 250);
}
function stopdoWave2()
{
clearTimeout(tempowave2);
}
function initwave()
{
doWave2(3);
stopdoWave2();
}
</SCRIPT>

6 réponses

  1. Utilisateur anonyme
     
    Salut!

    <SCRIPT LANGUAGE="JavaScript">
    var theText2 = "ecnadnet";
    function nextSize2(i,textLength) {
    return (20*Math.abs( Math.sin(i/(textLength/3.14)))+10);
    }
    function sizeCycle2(text2,dis2) {
    zob2 = ""
    for(i = text2.length; i > (-1) ; i--) {
    size2 = parseInt(nextSize2(i +dis2,text2.length));
    zob2 += "<font color='#910025' style='font-size: "+ size2 +"pt; letter-spacing: 0.3em;'>" +text2.substring(i,i+1)+ "</font>";
    }
    document.getElementById("theDiv2").innerHTML = zob2;
    }
    function doWave2(n) {
    sizeCycle2(theText2,n)
    if (n > theText2.length) {n=0}
    tempowave2 = setTimeout("doWave2(" + (n+1) + ")", 250);
    }
    function stopdoWave2()
    {
    clearTimeout(tempowave2);
    }
    function initwave()
    {
    doWave2(3);
    stopdoWave2();
    }
    </SCRIPT>

    que veux tu de plus?
    1
  2. Boukachaka
     
    Je veux rajouter un test avant pour détecter le navigateur,
    si IE laisser 0.3 comme valeur,
    si firefox mettre 0.1.
    0
  3. Utilisateur anonyme
     
    Essai comme ça!

    <SCRIPT LANGUAGE="JavaScript">
    var theText2 = "ecnadnet";
    function nextSize2(i,textLength) {
    return (20*Math.abs( Math.sin(i/(textLength/3.14)))+10);
    }
    function sizeCycle2(text2,dis2) {
    zob2 = ""
    for(i = text2.length; i > (-1) ; i--) {
    size2 = parseInt(nextSize2(i +dis2,text2.length));

    if ( navigator.userAgent.indexOf('MSIE') != -1 ) {

    zob2 += "<font color='#910025' style='font-size: "+ size2 +"pt; letter-spacing: 0.3em;'>"

    }
    else if ( navigator.userAgent.indexOf('Mozilla') != -1 ) {

    zob2 += "<font color='#910025' style='font-size: "+ size2 +"pt; letter-spacing: 0.1em;'>"

    }

    +text2.substring(i,i+1)+ "</font>";
    }
    document.getElementById("theDiv2").innerHTML = zob2;
    }
    function doWave2(n) {
    sizeCycle2(theText2,n)
    if (n > theText2.length) {n=0}
    tempowave2 = setTimeout("doWave2(" + (n+1) + ")", 250);
    }
    function stopdoWave2()
    {
    clearTimeout(tempowave2);
    }
    function initwave()
    {
    doWave2(3);
    stopdoWave2();
    }
    </SCRIPT>
    0
  4. Boukachaka
     
    Au moins là je suis pas emmerdé : ça ne marche plus sous IE6-7 ni firefox lol.
    Pas de bug, juste il affiche plus rien
    0
  5. Vous n’avez pas trouvé la réponse que vous recherchez ?

    Posez votre question
  6. Utilisateur anonyme
     
    arf :(

    rajoute

    alert('IE');dans la 1ere condition

    et
    alert('mozilla'); dans la deuxieme pour voir...
    0
  7. Boukachaka
     
    C'est bon j'ai trouvé, tu avais perdu un bout de code dans ton copier coller...

    vive la coloration syntaxique ! les points virgule manquant m'ont alertés :

    Voici le boût de code de la fonction que tu m'as corrigé :

    function sizeCycle2(text2,dis2) {
    zob2 = ""
    for(i = text2.length; i > (-1) ; i--) {
    size2 = parseInt(nextSize2(i +dis2,text2.length));
    if ( navigator.userAgent.indexOf('MSIE') != -1 ) {
    zob2 += "<font color='#910025' style='font-size: "+ size2 +"pt; letter-spacing: 0.3em;'>" +text2.substring(i,i+1)+ "</font>";
    }
    else if ( navigator.userAgent.indexOf('Mozilla') != -1 ) {
    zob2 += "<font color='#910025' style='font-size: "+ size2 +"pt; letter-spacing: 0.1em;'>" +text2.substring(i,i+1)+ "</font>";
    }
    }
    document.getElementById("theDiv2").innerHTML = zob2;
    }

    Marci et à plus
    0
    1. Utilisateur anonyme
       
      désolé ^^

      de rien bonne continuation
      0