Petit probleme javascript
Winterboard
Messages postés
137
Date d'inscription
Statut
Membre
Dernière intervention
-
Winterboard Messages postés 137 Date d'inscription Statut Membre Dernière intervention -
Winterboard Messages postés 137 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
voici un petit script que j'utilise pour remplacer <marquee> dans du xhtml:
Mais lors de l'utilisation il beuge extremement!
http://www.lou-castelet.fr/project2/fr/referencements.html
surtout sous FF
Merci de toute aide
voici un petit script que j'utilise pour remplacer <marquee> dans du xhtml:
<html><head><script type="text/javascript">
// Défilement 4 directions multiple
function Defilant(id, pos_init, pos_min, pos_max, delta, direction) {
this.id = id;
this.element = document.getElementById(id);
this.pos_init = pos_init;
this.pos_min = pos_min;
this.pos_max = pos_max;
this.pos_current = pos_init;
this.delta = delta;
this.direction = direction;
}
Defilant.prototype.defile = function() {
if (!this.element) {
this.element = document.getElementById(this.id);
}
if (this.element) {
if(this.direction == 'vertical'){
if(this.pos_current < (this.pos_min - this.element.offsetHeight) ){
this.pos_current = this.pos_init;
} else if (this.pos_current > this.pos_max ) {
this.pos_current = this.pos_init - this.element.offsetHeight;
} else {
this.pos_current += this.delta;
}
this.element.style.top = this.pos_current+"px";
} else if(this.direction == 'horizontal') {
if(this.pos_current < (this.pos_min - this.element.offsetWidth) ){
this.pos_current = this.pos_init;
} else if (this.pos_current > this.pos_max ) {
this.pos_current = this.pos_init - this.element.offsetWidth;
} else {
this.pos_current += this.delta;
}
this.element.style.left = this.pos_current+"px";
}
}
}
</script>
</head>
<body>
<div style='position: relative;overflow: hidden;width: 130px;height: 20px;'>
<span id='defileH1'
style='position: absolute;width: 90px;background-color:red;'
onMouseover="defileH_1.delta=0"
onMouseout='defileH_1.delta=deltaH1'
>
mon texte
</span>
</div>
<script type="text/javascript">
var deltaH1 = -1;
var defileH_1 = new Defilant('defileH1', 130, 0, 130, deltaH1,'horizontal');
setInterval("defileH_1.defile()",30);
</script>
</body></html>
Mais lors de l'utilisation il beuge extremement!
http://www.lou-castelet.fr/project2/fr/referencements.html
surtout sous FF
Merci de toute aide
A voir également:
- Petit probleme javascript
- Trier du plus petit au plus grand excel - Guide
- Petit 2 ✓ - Forum Windows
- A javascript error occurred in the main process - Forum Matériel & Système
- Petit point vert snap ✓ - Forum Snapchat
- Petit 3 ✓ - Forum Word
merci quand meme
peut tu me montrer precisement ou inserer le code silteplet
merci beaucoup :)
par setTimeout("defileH_1.defile()",100);
Fais des tests progressifs et augmente la deuxième valeur jusqu'à 1000 pour voir si ça s'améliore.
Il n'y a plus rien d'affiché :-s