Skip to main content

Bug Tracker

Side navigation

Ticket #4232: offset_visible.html


File offset_visible.html, 0.8 KB (added by cmlenz, February 24, 2009 04:51PM UTC)

HTML test page

<!DOCTYPE html>
<html>
  <head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script>
    <script>
      $(function() {
        var row = $("table tr:first");
        if (row.is(":visible")) {
          var tr = row[0];
          alert("Oops, invisible row is :visible (offsetWidth = " + tr.offsetWidth + "px, offsetHeight = " + tr.offsetHeight + "px)");
        } else {
          alert("All is well");
        }
      });
    </script>
  </head>
  <body>
    <table border="1">
      <tr style="display: none">
        <td class="name">This row is hidden</td>
        <td class="addr">Bla bla bla</td>
      </tr>
      <tr>
        <td class="name">This row is visible</td>
        <td class="addr">Bla bla</td>
      </tr>
    </table>
  </body>
</html>

Download in other formats:

Original Format