Jquery - Click outside Div to Hide a Div

妖精的绣舞 提交于 2019-12-25 07:49:58

问题


I am using this: http://www.useful-dates.com/search/

What script do I need to use so that the scrolled underneath scrolled div stays hidden and then appears when you click it and disappears when you click outside of the appears div?

Like this, but i have had no luck duplicating: http://rob-bell.net/static/ddlist.html

Iv searched and tried all kinds of things on the net and no luck, please help.


回答1:


Something has to be there in the background to catch the click. Looks like they used display: block with a fixed height/width in the working example, so that a click outside the drop-down would hit the "body" element, to which the event is attached.



来源:https://stackoverflow.com/questions/9237516/jquery-click-outside-div-to-hide-a-div

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!