Getting a leg over (British)

"Getting a leg over", meaning having sexual relations, is nice and visual -- but when did the phrase originate?