Magnetic

Ported from http://jsdo.it/hakim/magnetic-02