Skip to main content

How to fold up the web like a piece of paper

Displays that you can fold up and put in your pocket may still be a way off, but Dan Motzenbecker has developed the next best thing for now; a JavaScript library called OriDomi that you can use to add foldable elements to your website layout.

With OriDomi you can take a DOM - which can contain text, pictures, animation or whatever - and turn it into an interactive toy that can be folded by clicking or dragging it. There are various folding effects available, that you can customise to your heart's content. You can use OriDomi to queue different effects, there's a ripple function that enables you to stagger the animation along every fold, rather than having every fold move at the same time, and you can still change the content of a DOM after it's been modified.

It's compatible with iOS, in case you want to fold things by touch, and if your site uses responsive design the OriDomi can change the size of your foldable DOM to reflect the size of the browser window.

Naturally it requires a fairly up-to-date browser that supports CSS3 transforms - if you're on IE 10 or older then forget about it - but there's a built-in test for browser support that you can include with your code.

Find out more - and see plenty of instructive JavaScript examples and tips on how to get great results - at the OriDomi site, or simply download it at Github and get to work on making your own foldable site.

Words: Jim McCauley

Liked this? Read these!

Seen a useful JavaScript library? Tell us about it in the comments!