JavaScript Color Class

UPDATE 09/02/11: This project is now available on github: https://github.com/moagrius/Color. Generally, the most recent updates will be found there – I’ll try to keep this page updated as well, but consider the repo linked to be ‘official’. Also proposing this as the new AMD module for the next major MooTools release (https://github.com/moagrius/Color-1). If you’ve seen […]

MooTools – copy all styles (copyCSS)

port from the jQuery version here.

Note the try/catch and direct style assignation in the IE block – I was getting back an error from MooTools setStyle when setting some returned style values. At some point, I’ll probably try and narrow it down and get rid of the try/catch.

MooTools – hitTest and hitTestObject

jQuery + MooTools – test if element is entirely within viewport

Working on an application that had heavy use of multiple-tiered custom context menus, and needed to position sublevels based on it’s net position relative to the viewport (if there’s not room on the right of the originating element, position it to the left – same with top/bottom). Here’s the MooTools version…

Takes either ‘x’ […]

jQuery + MooTools – visible offset

I was working on a project recently that had a dynamically populated container whose size varied greatly based on search, filter, and user preferences. I wanted to add a loading graphic to the center of the element during ajax operations, and found that if the container was very large, centering the graphic occured offscreen. here’s […]