Trigger an event when an element is being dynamically hidden or shown.