Update overlay.js

Created the `preventHide` function