Bonjour.
Ma zone affichable <body> s'agrandit sous IE8 lorsque je tente de déplacer mon élément hors de celle ci, malgré l'overflow hidden. Je n'ai pourtant pas ce souci sous FF, Opera, IE6, IE7....
Est-ce que quelqu'un pourrait m'aiguiller sur ce point ? (je flanche après des heures de recherche...)
Ci joint, un code exemple simplifié, pour voir ce que ca donne :
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
73
74
75
76
77
78
79 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" /> <!--<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />--> <style type="text/css"> html, body { overflow: hidden; margin: 0; padding: 0; height: 100%; } html { position: absolute; z-index: 0; width: 1000px; max-width: 1000px; border: 1px solid blue; } body { position: relative; z-index: 1; width: 900px; max-width: 900px; border: 1px solid green; } #bloc { position: absolute; z-index: 2; height: 500px; width: 500px; background: red; } #testBug { font: 40px Trebuchet MS, Verdana; } </style> <script type="text/javascript"> function addEvent(obj, event, fct) { if (obj.attachEvent) { obj.attachEvent("on" + event, fct); } else { obj.addEventListener(event, fct, true); } } var curX = 0; var curY = 0; function getPos (e) { curX = e.clientX; curY = e.clientY; if (dragging) { return false; } } addEvent(document, 'mousemove', getPos); var elt = ''; var dragging = false; var dragInterval = ''; var decalX = 0; var decalY = 0; var nextPosX = 0; var nextPosY = 0; var onDrag = ''; function dragElt (elt) { if (elt) { if (!(elt.style.top)) { elt.style.top = 0 +'px'; } if (!(elt.style.left)) { elt.style.left = 0 +'px'; } if (!dragging) { dragging = true; decalX = curX - parseInt(elt.offsetLeft); decalY = curY - parseInt(elt.offsetTop); onDrag = function() { nextPosX = curX - decalX; nextPosY = curY - decalY; if (nextPosY <= 0) { nextPosY = 0; } elt.style.left = nextPosX + 'px'; elt.style.top = nextPosY + 'px'; elt.focus(); }; dragInterval = setInterval(onDrag, 10); } } else { dragging = false; clearInterval(dragInterval); } } </script> <title>Area 404</title> </head> <body id="top"> <div id="testBug">testBug</div> <div id="bloc" onmousedown="dragElt(this); this.style.cursor = 'move';" onmouseup="dragElt(); this.style.cursor= 'auto';">yop</div> </body> </html>
Partager