Размеры и положение узла
Привет
Как получить реальные размеры и положение узла? С помощью getComputedStyle получаю: auto в ff, 0px в хроме и 130px (:blink: :blink: :blink: :blink: ) в опере. wtf? Как узнать настоящий размер во всех (ну хотя бы в тех, что выше) браузерах? |
пардон, код забыл вложить
<style> #container { margin-top: 60px; position: absolute; width: 2000px; } .day { position: relative; display: inline; } .day h2 { padding: 0 5px; position: absolute; left: 4px; top: -65px; } .event { width: 50px; height: 50px; border: 1px solid black; margin: 0 4px; display: inline-block; } </style> <script> window.addEventListener('load', function(){ var container = document.getElementById('container'); var compStyle = window.getComputedStyle(container.getElementsByClassName('day')[1], null); alert('width: ' + compStyle.width) }, false) </script> <div id="container"> <div class="day"> <h2>День 1</h2> <div data-event-id="0" class="event">1</div> <div data-event-id="1" class="event">2</div> <div data-event-id="2" class="event">3</div> <div data-event-id="3" class="event">4</div> </div> <div class="day"> <h2>День 2</h2> <div data-event-id="4" class="event">1</div> <div data-event-id="5" class="event">2</div> </div> </div> |
|
Часовой пояс GMT +3, время: 07:01. |