JS pop-up box clicks outside to hide the trick code

小云云
Release: 2018-03-07 15:14:56
Original
2003 people have browsed it

This article mainly shares with you the JS pop-up box click external hidden skill code, I hope it can help everyone.

$(document).click(function (e) { if (!$(e.target).hasClass('alert-container') && $(e.target).parents('.alert-container').length === 0 && !$(e.target).hasClass('btn-eco-bell') && $(e.target).parents('.btn-eco-bell').length === 0) { that.$el.find('#bellp').hide(); }
Copy after login

The trick of this event binding is that the alert-container class is a pop-up window p, and btn-eco-bell is a click button. If you click the button or click inside the pop-up window, the pop-up window will not be hidden. Clicking outside will hide the pop-up window. Window p

Related recommendations:

JS custom pop-up box plug-in encapsulation example introduction

javascript example of implementing a pop-up box that cannot be closed Code

jQuery click anywhere to hide DIV function

The above is the detailed content of JS pop-up box clicks outside to hide the trick code. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!