new: Element.pin

Here’s a little Mootools extension that you might find useful. I’m using it my StickyWin classes to allow the user to “pin” it in place so it won’t move if they scroll.

$('fxTarget').pin()

Execute the example, then scroll. That’s it. You can unpin it if you like:

$('fxTarget').unpin()

(note, in this example because of the way my little fxTarget helper works, unpin will break the drag behavior, but that won’t happen in other instances).

I’ve added .pin and .unpin to StickyWin, too.

6 Responses to “new: Element.pin”

  1. Michael Says:

    That is awesome. Once again I thank you!

  2. Rumble Says:

    Looks like a neat idea, doesn’t seem to work in IE 6 though - throws three nasty looking javascript error messages!

  3. Aaron N. Says:

    Fixed. I had a trailing comma in my code.

  4. Dave Salazar Says:

    This seems to be ridden with problems. Anyone else having problems using this?

  5. Aaron N. Says:

    Ridden? …What are the problems you are having with it? Note that if you are pinning an element that is contained within another that is positioned, you may have offset problems.

  6. Dave Salazar Says:

    I apologize, i was mistaken, seems to work fine. You may delete my posts if you wish :)

Leave a Reply

You must be logged in to post a comment.