On 5-Sep-06, at 4:31 AM, Marc Boeren wrote:

> If I just want to change the x-position or the height of an element, I
> can't use the setElementPosition/Dimensions function. How about an API
> extension where you can pass null for an argument and that argument
> will not be updated? (another option would be to add setElementHeight
> and setElementWidth).
>
> Simple usage example in an onresize handler:
>
>   setElementDimensions(fixedwidthelement,
>                        {w:null, h: getViewportDimensions().h});
>
> Implementation (based on current setElementPosition):
>
> setElementPosition = function (elem, newPos/* optional */, units) {
>     elem = MochiKit.DOM.getElement(elem);
>     if (typeof(units) == 'undefined') {
>         units = 'px';
>     }
>     var style = {};
>     if (newPos.x!==null) style.left = newPos.x + units;
>     if (newPos.y!==null) style.top = newPos.y + units;
>     MochiKit.DOM.updateNodeAttributes(elem, {'style': style});
> };
>
> Same for setElementDimension.
>
> I can supply a patch if anyone is interested.

What about sending objects with just one or the other dimension, like  
this:

     setElementDimensions(elem, {h: 123});

instead of:

     setElementDimensions(elem, {w: null, h: 123});

Beau


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~----------~----~----~----~------~----~------~--~---

Reply via email to