The mechanism of action of Demerol is smooth muscle contraction. It causes contraction of all the visceral smooth muscles like intestinal smooth muscle contraction leading to constipation. In the eye, it causes contraction of the sphincter pupillae. When the muscle contracts due to Demerol, it shortens in length. Thus causing pupillary dilatation.Hope this is clear to you now.