Docs says:
getViewportDimensions(element)
But the function has no arguments.
--
Leonardo Soto M.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
MochiKit group.
To post to this group, send email to
Hi!,
Sometimes I need to get the 'client' dimension of an element, not the
regular dimension that elementDimension() returns. [See
www.mozilla.org/docs/dom/domref/clientWidth.html].
The following function works:
:mochidef:`elementInnerDimensions(element)`:
Return the absolute pixel
Beau Hartshorne wrote:
Thanks for pointing this out. Do you think the function should take an
optional win parameter?
Doesn't withWindow() already covers that?.
--
Leonardo Soto M.
Desarrollador de Software | Administrador de Sistemas
[EMAIL PROTECTED] | [EMAIL PROTECTED]
That'd be me. Is this correct:
getViewportDimensions: function() {
var d = new MochiKit.DOM.Dimensions();
var self = MochiKit.DOM;
if (window.innerWidth) {
d.w = self._window.innerWidth;
d.h = self._window.innerHeight;
} else if
Not quite, there are a two spots that I can see that you missed:
if (window.innerWidth) {
..
} else if (self._document.body document.body.clientWidth) {
I'd write it more compactly using a couple more locals instead of
repeating self.foo.bar.baz ad nauseam.
-bob
On Mar 3, 2006,