Bug Tracker

Ticket #3037: offset.html

File offset.html, 1.0 KB (added by epsilon68, 6 years ago)

test case

Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2                    "http://www.w3.org/TR/html4/loose.dtd">
3<html>
4<head>
5<script src="http://code.jquery.com/jquery-latest.js"></script>
6<script>
7  $(document).ready(function(){
8   
9    var mybox = $('div.box.bubble');
10        var myoffset = mybox.offset();
11        $('#offset_left').html(''+myoffset.left);
12        $('#offset_top').html(''+myoffset.top);
13
14  });
15</script>
16<style>
17div.box.bubble {
18        left: 50px;
19        top: 100px;
20        width: 100px;
21        height: 80px;
22        background: green;
23        position: absolute;
24        display:none;
25        visibility:hidden;
26}
27</style>
28</head>
29<body>
30
31        <div class="box bubble">it is a popup window</div>
32
33        coordinates of the div element (absolute and display: none) <br>
34    left: <span id="offset_left"></span> (instead of 50)<br>
35    top: <span id="offset_top"></span> (instead of 100)<br>
36        <br>
37        display: none is the problem. replacing it by visibility: hidden gives the right results but is not the right way for doing effects on it (as it uses extensively the css display).
38
39</body>
40</html>