本文主要和大家分享js弹框点击外部隐藏技巧代码,希望能帮助到大家。
$(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(); }
此事件绑定技巧在于alert-container类为弹窗p,btn-eco-bell为点击按钮,如果点击按钮或者点击弹窗内部,不隐藏弹窗,点击外部都会隐藏弹窗p
相关推荐:
以上就是JS弹框点击外部隐藏技巧代码的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号