Fixed a bug where clicking on menu itself never hide the layer
Added layer z-index dynamic calculation