Bonjour,
j'utilise un script js pour faire un texte défilant qui contient des liens et qui s'arrête de défiler quand on le survole. Voici le résultat
et voici le code :avec le code du fichier js :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 <style type="text/css"> .txt_defil {font-size:11px;font-family:Arial;color:#FFFFFF;text-decoration:none} .txt_defil:link {font-size:11px;font-family:Arial;color:#FFFFFF;text-decoration:none} .txt_defil:visited {font-size:11px;font-family:Arial;color:#FFFFFF;text-decoration:none} .txt_defil:hover {font-size:11px;font-family:Arial;color:#FFFFFF;text-decoration:underline} </style> <script language="JavaScript"> <!-- var txt_defil_width = 1000; //largeur var txt_defil_height = 23; //hauteur var txt_defil_bgcolor = 'green'; //couleur de fond var txt_defil_background = ""; //image de fond var txt_defil_info = new Array; txt_defil_info[0]='<a href="http://www.stdswebport.org/index.php?langue=fr" target="_blank" CLASS=txt_defil><b>Si vous avez besoin de normes, inscrivez-vous à StandardsWebPort. </b></a> <b>En 2011 nouvel accès possible aux Bases Documentaires des Techniques de l\'Ingénieur,</b> <a href=""><b> plus d\'infos</b></a>'; //--> </script> <script language="JavaScript" src="textdefil_ho1.js"></script>
Mon problème, c'est que pour voir tout le texte, je suis obligé de faire un texte défilant très large ; or, je voudrais le faire environ 2 fois moins large, mais du coup, toute la fin du texte disparaît ; comment peut-on faire ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72 //PLF - http://www.jejavascript.net/ function writext(texdef) { document.write(texdef); } writext('<DIV ID=txt_defil_relativ onMouseOver="txt_defil_stop()" onMouseOut="txt_defil_rstart()" STYLE="position:relative;width:'+txt_defil_width +';height:'+txt_defil_height+';background-color:'+txt_defil_bgcolor+';background-image:url('+txt_defil_background+')">'); writext('<DIV ID=txt_defil_cadre STYLE="position:absolute;width:'+(txt_defil_width -3)+';height:'+(txt_defil_height-8)+';top:4;left:1;clip:rect(0 '+(txt_defil_width -3)+' '+(txt_defil_height-8)+' 0)">'); writext('<div id=txt_defiler_1 style="position:absolute;width:'+(txt_defil_width -3)+';left:0;top:0;" CLASS=txt_defil >'+txt_defil_info[0]+'</DIV>'); writext('<div id=txt_defiler_2 style="position:absolute;width:'+(txt_defil_width -3)+';left:'+txt_defil_width+';top:0;" CLASS=txt_defil >'+txt_defil_info[1]+'</DIV>'); writext('</DIV></DIV>'); txt_defil_1 =1; txt_defil_2 = 0; stop_mouss=0; function txt_defil_f1() { if(txt_defil_1 == 1) { txt_defil_haut = "txt_defiler_1"; txt_defil_bas = "txt_defiler_2"; txt_defil_1 = 0; } else { txt_defil_bas = "txt_defiler_1"; txt_defil_haut = "txt_defiler_2"; txt_defil_1 = 1; } txt_defil_nb_info = txt_defil_info.length-1; if(txt_defil_2 == txt_defil_nb_info) txt_defil_next = 0; else txt_defil_next = txt_defil_2+1; if(document.getElementById) document.getElementById(txt_defil_bas).innerHTML = txt_defil_info[txt_defil_next]; txt_defil_left = 0; if(document.getElementById) txt_defil_f2 () } function txt_defil_f2 () { if (stop_mouss == 0) { txt_defil_left -= 2; document.getElementById(txt_defil_haut).style.left = txt_defil_left; document.getElementById(txt_defil_bas).style.left = txt_defil_left+txt_defil_width; if((txt_defil_left+txt_defil_width) > 0) move2=setTimeout("txt_defil_f2 ()",5) else txt_defil_f3() } else move1=setTimeout("txt_defil_f2 ()",1000) } function txt_defil_f3() { txt_defil_2 = txt_defil_next; txt_defil_f1() } function txt_defil_stop() { stop_mouss=1; } function txt_defil_rstart() { stop_mouss=0; } window.onload = txt_defil_f1;
Partager