On 5/16/06, Jose R <[EMAIL PROTECTED]> wrote:
>
> I want to check for a position of an absolute positioned div and move
> down or up depending of its position
> you can see the project im working on here (i wanna the horizontal dark
> button to make move the banner div, up or down depending of the
> position of the div)
>
> http://mochikit.sc31.info/
>
> // Heres the function im using, I know is very prmitive... so i know
> there is a
> // better and incredible way using mochikit. so give me a hand
> please!!!
> function DownUpDiv() {
> y_position = document.getElementById('DIVID').style.top;
> if(y_position<=1) {
> // if is up put it down!
> document.getElementById('DIVID').style.top = 0;
> } else {
> // if is down... put it up!
> document.getElementById('DIVID').style.top = -450;
> }
> }
Here is how I would do it with MochiKit:
function DownUpDiv() {
position = getElementPosition('DIVID');
position.y = position.y < 0 ? 0 : -450
setElementPosition('DIVID', position);
}
You _should_ look at the Mochikit.DOM documentation
<http://mochikit.com/doc/html/MochiKit/DOM.html>.
--
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 [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
-~----------~----~----~----~------~----~------~--~---