Ik heb een script gemaakt dat layers scrollt en het werkt perfect... in IE. Netscape geeft geeen enkele sjoege, opera doet het wel, maar positioned verkeerd. Hebben jullie wat tips waar ik op moet letten om het cross-browser compitable te maken.
code:
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
73
74
75
76
77
78
79
80
81
82
| <SCRIPT language=JavaScript>
var leftBuzy = false
var rightBuzy = false
var position1 = 0;
var count = 0;
var ID1,ID2;
var scroll = 105;
var countplus = 0;
var maxstep = 8 - 3;
var step = 0;
scrollSteps= 15;
scrollDelay=70;
var ns = navigator.appName == "Netscape";
if (ns) {
//laag1Obj = 'document.layer1.document.laag1'
var myElement = document.getElementById("laag1");
laag1Obj = 'myElement.style'
} else {
laag1Obj = 'document.all["laag1"].style'
}
function goRight(){
if (!rightBuzy){
leftBuzy = false;
rightBuzy = true;
checkPosistion("right");
if (step != 0){
moveRight()
step--;
}
}
}
function goLeft(){
if (!leftBuzy){
leftBuzy = true;
rightBuzy =false;
checkPosistion("left");
if (step < maxstep){
moveLeft()
step++;
}
}
}
function moveRight(){
clearTimeout(ID2);
eval(laag1Obj).left=(position1+=scrollSteps)
count+=scrollSteps
if (count >= countplus) {
rightBuzy = false;
clearTimeout(ID1);
} else {
ID1=setTimeout('moveRight()',scrollDelay);
}
}
function moveLeft(){
clearTimeout(ID1);
eval(laag1Obj).left=(position1-=scrollSteps)
count-=scrollSteps
if (count <= countplus) {
leftBuzy = false;
clearTimeout(ID2);
} else {
ID2=setTimeout('moveLeft()',scrollDelay);
}
}
function checkPosistion(direction){
if(direction=="right"){
countplus = position1 + scroll;
}
if(direction=="left"){
countplus = position1 - scroll;
}
}
// -->
</SCRIPT> |