Skip to main content

Bug Tracker

Side navigation

Ticket #5086: jquery-test-case.html


File jquery-test-case.html, 0.7 KB (added by zachleat, August 20, 2009 06:20PM UTC)

First button shows correct offset, second button shows incorrect offset (if page overflows)

<!doctype html>
<html>
	<head>
		<title>Offset Test</title>
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
        <script type="text/javascript">
        $(function()
        {
            $('body').show();
            $('.getOffsetTest').click(function()
            {
                alert($('#secondButton').offset().top);
            });
        });
        </script>
	</head>
<body style="display: none;">
    <button class="getOffsetTest">Find Offset of Second Button</button>
    <div style="height: 1500px"></div>
    <button id="secondButton" class="getOffsetTest">Find Offset of Second Button</button>
</body>
</html>

Download in other formats:

Original Format