Aide javascript scrolling vertical

hltyson13 Messages postés 1 Date d'inscription mardi 8 avril 2003 Statut Membre Dernière intervention 28 avril 2005 - 28 avril 2005 à 11:03
GhislainLavoie Messages postés 289 Date d'inscription vendredi 11 mars 2005 Statut Membre Dernière intervention 3 avril 2008 - 30 avril 2005 à 01:41
bonjour,
J'utilise un javascript pour le défilement de news au format texte.
le voici:
"
<head><meta http-equiv="refresh" content="1000; url="letexte.htm">
<script language="Javascript1.1">
<!--
var ie= document.all ? 1 : 0var enableScroll ((navigator.appName "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >3))
if(enableScroll)
{
var tScroll;
var curPos = 0;
var direction=1;
}
function runTimer()
{
if(enableScroll)
{
if (direction)
{curPos += 1
window.scroll(0,curPos)}
else
{window.scroll(0,0)
curPos=0}


if ( curPos > 15000)
direction=0;
if (curPos < 3)
direction=1;

tScroll = window.setTimeout("runTimer();", 50)
}
}
if (enableScroll){
if (ie) window.onload = runTimer
if (ie) window.onunload = new Function("clearTimeout(tScroll)")
}
//-->
</SCRIPT>
</head>
"
Je voudrai que le défilement soit en continu: est ce possible ? et si oui quelle modification doit etre effectuée ?
En vous remerciant pour votre aide

Hugo

2 réponses

GhislainLavoie Messages postés 289 Date d'inscription vendredi 11 mars 2005 Statut Membre Dernière intervention 3 avril 2008 3
30 avril 2005 à 01:37
Salut!

J'ai fait des modifs au script pour atteidre le début de la page après avoir atteint la fin de celle-ci.


<script type= "text/javascript">
<!--

var ie
= document
.all ?
1
:
0

var enableScroll
= window
.scroll;

if(enableScroll
)

{

var tScroll;

var curPos
=
0;
window
.scroll
(0,0);

}

function runTimer
()

{

if(enableScroll
)

{
curPos
+ = vitesseScroll;
window
.scroll
(0,curPos
);
wait
=
50;

if
((ie?document
.body
.scrollTop
: window
.pageYOffset
)
< curPos
)

{
curPos
=0;
wait
= 2000; // 2 secondes avant de reourner au début

}
tScroll
= window
.setTimeout
("runTimer();", wait
)

}

}

if
(enableScroll
){
window
.onload
= runTimer
window
.onunload
=
new
Function("clearTimeout(tScroll)")

}
//-->
</SCRIPT>

A+, Ghislain
0
GhislainLavoie Messages postés 289 Date d'inscription vendredi 11 mars 2005 Statut Membre Dernière intervention 3 avril 2008 3
30 avril 2005 à 01:41
oups!

change la ligne :

curPos += vitesseScroll;

par :
curPos
+=
1;

A+, Ghislain
0
Rejoignez-nous