views:

753

answers:

1

OK, regarding... the demo of Scriptaculous' Effect.Move which can be found here

<style type="text/css">
  a#move_demo { background:#fa0000; color:#fff; padding:5px; border:1px solid #000; }
</style>

<div class="demo">
  <a href="#" id="move_demo" onclick="new Effect.Move(this, { x: 60, y: -30 }); return
false;">Click me for a demo!</a>
</div>

With a single page containing that, document.viewport.getHeight() returns 32, while for width, it's fine.

Why is this the case? Shouldn't it be the height of viewport, not the height from top of the document to the bottom?

Is there a workaround?

Thanks.

+3  A: 

Well.

Turns out you need a correct DOCTYPE to make it work properly, otherwise Prototype will be in "quirks mode" which doesn't let getheight() work as intended.

Problem solved, then. Now time to wait 48 hours >_>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
a2h