hidakwon786
Messages postés2Date d'inscriptionjeudi 7 février 2008StatutMembreDernière intervention12 mars 2008
-
12 mars 2008 à 16:40
hidakwon786
Messages postés2Date d'inscriptionjeudi 7 février 2008StatutMembreDernière intervention12 mars 2008
-
12 mars 2008 à 17:19
Bonjour,
Je suis en train de programmer un petit site pour les cours, j'ai récupéré un CS pour faire en JS une zone ou des annonces défilent, sous IE, c'est niquel, mais alors sous FF, lorsqu'une nouvelle annonce apparait, ça lague a soujait...
Pouvez vous voir si l'on peu faire quelque chose, cas c'est vraiment génant, l'un des consignes est que cela soit compatible IE/FF.
Merci d'avance de m'éclairer, voici le CS:
<quote>
<hr size= "2" width="100%" /><html>
<head>
<title>Holoc</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
#pscroller1{
font-size: 12px;
font-family: verdana;
width: 215px;
height: 270px;
border: 0px solid black;
padding: 5px;
background-color: white;
}
.someclass{ //class to apply to your scroller(s) if desired
}
</style>
<script type="text/javascript">
var pausecontent=new Array()
//alert('pausecontent');
/*pausecontent[0]='[# Annonce 1]
Brève description limitée à 25 caractères'*/
pausecontent[0]='
78970 MEZIERES SUR SEINE <hr>[# ]<hr>Maison, 175 m², 280000 ? Belle maison dans quartier chic, près du <hr>
'
pausecontent[1] ='
83000 TOULON<hr>[# ]<hr>Maison, 300 m², 1200000 ? Magnifique villa de prestige, appartenant anciennement à Tiger Wood<hr>
'
pausecontent[2]= '
78970 MEZIERES SUR SEINE <hr>[# ]<hr>Maison, 220 m², 315000 ? Maison clin d\'oeil à vous devinerez qui <hr>
'
function pausescroller(content, divId, divClass, delay){
//alert('pausescroller');
this.content=content //message array content
this.tickerid=divId //ID of ticker div to display information
this.delay=delay //Delay between msg change, in miliseconds.
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
this.hiddendivpointer=1 //index of message array for hidden div
document.write('
'+content[0]+'
'+content[1]+'
')
var scrollerinstance=this
if (window.addEventListener) //run onload in DOM2 browsers
window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
else if (window.attachEvent) //run onload in IE5.5+
window.attachEvent("onload", function(){scrollerinstance.initialize()})
else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
setTimeout(function(){scrollerinstance.initialize()}, 500)
}
// -------------------------------------------------------------------
// initialize()- Initialize scroller method.
// -Get div objects, set initial positions, start up down animation
// -------------------------------------------------------------------
pausescroller.prototype.initialize=function(){
//alert('pausescroller.prototype.initializ');
this.tickerdiv=document.getElementById(this.tickerid)
this.visiblediv=document.getElementById(this.tickerid+"1")
this.hiddendiv=document.getElementById(this.tickerid+"2")
this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv))
//set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"
this.getinline(this.visiblediv, this.hiddendiv)
this.hiddendiv.style.visibility="visible"
var scrollerinstance=this
document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}
if (window.attachEvent) //Clean up loose references in IE
window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})
setTimeout(function(){scrollerinstance.animateup()}, this.delay)
}
// -------------------------------------------------------------------
// animateup()- Move the two inner divs of the scroller up and in sync
// -------------------------------------------------------------------
pausescroller.prototype.animateup=function(){
//alert('pausescroller.prototype.animateup');
var scrollerinstance=this
if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){
this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px"
this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px"
setTimeout(function(){scrollerinstance.animateup()}, 20)
}
else{
this.getinline(this.hiddendiv, this.visiblediv)
this.swapdivs()
setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
}
}
// -------------------------------------------------------------------
// swapdivs()- Swap between which is the visible and which is the hidden div
// -------------------------------------------------------------------
pausescroller.prototype.swapdivs=function(){
//alert('pausescroller.prototype.swapdivs');
var tempcontainer=this.visiblediv
this.visiblediv=this.hiddendiv
this.hiddendiv=tempcontainer
}
// -------------------------------------------------------------------
// setmessage()- Populate the hidden div with the next message before it's visible
// -------------------------------------------------------------------
pausescroller.prototype.setmessage=function(){
//alert('pausescroller.prototype.setmessage');
var scrollerinstance=this
//if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
//setTimeout(function(){scrollerinstance.setmessage()}, 100)
//else{
var i=this.hiddendivpointer
var ceiling=this.content.length
this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]
this.animateup()
//}
}
pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any
//alert('pausescroller.getCSSpadding');
if (tickerobj.currentStyle)
return tickerobj.currentStyle["paddingTop"]
else if (window.getComputedStyle) //if DOM2
return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")
else
return 0
}
function displayDate() {
var now = new Date();
var today = now.getDate();
var month = now.getMonth();
var monthName = new Array(12)
monthName[0]="Janvier ";
monthName[1]="Février ";
monthName[2]="Mars ";
monthName[3]="Avril ";
monthName[4]="Mai ";
monthName[5]="Juin ";
monthName[6]="Juillet ";
monthName[7]="Aout ";
monthName[8]="Septembre ";
monthName[9]="Octobre ";
monthName[10]="Novembre ";
monthName[11]="Décembre ";
var year = now.getFullYear();
cs_bultez
Messages postés13615Date d'inscriptionjeudi 13 février 2003StatutMembreDernière intervention15 octobre 201330 12 mars 2008 à 16:49
Bonjour,
>>ça lague a soujait...
en frenchy ? ça veut quoi dire ?
pas trouvé d'erreur "sauf" .someclass{ /*class to apply to your scroller(s) if desired*/
quand à l'exécution, en local, pas de différences notables IE / FF / Opera /K-Meleon / Safari
hidakwon786
Messages postés2Date d'inscriptionjeudi 7 février 2008StatutMembreDernière intervention12 mars 2008 12 mars 2008 à 17:19
"ça lague à souhait :)"
Je vais vérifier ça ce soir, sinon, j'ai trouvé, en evitant de redimentionner à la volée l'image. Je charge l'image déjà dimentionnée, et alors ça passe bien sous FF. Sinon, je vais voir si il n'y a pas un problème ou tu m'a montré.