A current-carrying wire generates around it a circular magnetic field in a way described by the right hand rule. That is to say, if you had a wire pointing from the bottom to the top of this page, the magnetic field to the left of that wire would be coming out toward you, while on the right side of the wire that circling field would be heading into the page.
As a result, when you put two such parallel wires together, with current traveling in the same direction, those wires will attract. At the point at which their respective magnetic fields intersect, they are traveling in opposite directions, and opposites attract.
An English doctor and inventor named Peter Mark Roget (of thesaurus fame) devised a whimsical contraption in 1835 that exhibited this principle in action. Known both as a contracting helix and Roget’s spiral, it is demonstrated in the tutorial below. Because it turns electricity into motion, the contracting helix is a type of primitive motor, akin to Faraday’s motor.
A Wire Helix hangs from a metal frame so that its bottom tip dips into a metal-bottomed glass Cup containing mercury, a liquid which readily conducts current. When a Battery (in the form of a grenet cell in this tutorial) supplies current to the wire, the long series of parallel wires inherent in the form of the helix attract each other, causing the helix to contract. As it does, the end is lifted out of the mercury, breaking the circuit and discontinuing the current. As there is no longer current in them, the parallel wires no longer attract each other, the spiral relaxes, its tip falls back into the mercury bath, and the whole cycle begins anew. The result is a constant contracting and relaxing of the coil, producing a Slinky-like effect. In addition, whenever the coil tip is lifted from the mercury, a spark gap is created, creating a brief spark. You can interrupt this cycle by disconnecting the circuit with the red Turn Off button to open the Knife Switch or by adjusting the Coil Height slider.