There’s a handful of helper methods I end up using in every script I write, so I decided to bundle them into a helper library called Buoy.
I end up reusing the same methods over and over again in my JS plugins. If I’m using more than one of them on a projects, this let’s me keep my code more DRY and reduces my overall file size.
buoy.forEach- Todd Motto’s method for looping through arrays, nodelists, and objects.
buoy.extend- Merge two or more objects.
buoy.getHeight- For reliably getting the height of an element.
buoy.getOffsetTop- Get an element’s distance from the top of the Document.
buoy.getClosest- Get the closest matching element up the DOM tree. Match by class, ID, data attribute, or tag.
buoy.getParents- Get an element’s parent nodes. Optionally filter by class, ID, data attribute, or tag.
buoy.getSiblings- Get an element’s sibling nodes.
buoy.getQueryString- Get data from a URL’s query string.