Hide the widget after a popup opens

Is it possible to hide the widget itself when you open a popup?