简体   繁体   中英

Does the div or any html element visibility affect the "mouseenter" function?

如果我的 div 设置为visibility:hidden会影响onmouseenteronmouseout函数的行为吗?

Yes it will. Despite that the element remains visually in the document flow by leaving a space, you can't mouse-in to it because it is not visually on the page.

Something which is hidden is absent in the page. so you can't invoke any mouse events.

Yes, although it still catches some space in the flow, you can't interact with it.

See example here .

yes it will get affected. As the div is hidden, mousein, mouseout and other related events will not be triggered. Check this silly fiddle.

$("#foo").mouseout(function(){ // This will stop being triggered once its invisible

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM