Limit value to min & max using one line of code

I wanted to share this dead-simple yet very useful JavaScript snippet I created, with which you can make sure a value stays within a certain minimum and maximum value. It takes three values (all integers): value to check, minimum and maximum, and returns the value..

Continue reading

Collision prevention using jQuery

I was building a graph with Flot.js and wanted to display descriptive labels, placed above some vertical lines inside the graph, inside a gutter. I ran into the problem that, as the positioning of these labels was absolute, these labels would regularly overlap each other,..

Continue reading

Adaptive background using jQuery

To conserve bandwidth with large images, it can be a smart thing to offer your user only the image needed, based on their device size. Furthermore, it will allow you to output higher definition, and thus crispier, images for larger screens without compromising loading times..

Continue reading

Momentum scrolling using jQuery

tl;dr? Click here. Momentum – or inertial – based scrolling is one of the fairly ‘new’ phenomena introduced by touch devices in the last few years. Compared with a regular (linear) scroll, momentum scrolling offers a more natural way of scrolling that is easier on..

Continue reading

The Manifesto Manifesto

How to write a manifesto. Today, we write a manifesto. Today, our second sentence starts with the first word of the first sentence. We write a short sentence. Then a shorter one. Then a really, really long one that maybe doesn’t make any sense but..

Continue reading

Debouncing events with jQuery

For a thing I’m working on, I needed a ‘debounced‘ resize event, as the $(window).resize event keeps firing as long as the user resizes his window. Maximizing the window with a single click just causes 1 event fired, but by dragging the browser window bigger/smaller,..

Continue reading