EASIEST Click Outside function to close menu with HTML, CSS, JavaScript
HTML-код
- Опубликовано: 26 июл 2023
- Thank you for watching my video please don't forget to LIKE and SUBSCRIBE.
My gaming channel: / @jonvadar
Support me: www.buymeacoffee.com/jonvadar
My website: jonvadar.xyz/
#javascript #html #css #learnwebdevelopment - Наука
Nice video.
But sometimes the toggle button may contain other HTML elements too, e.g. , , etc. In that case the code shown in this video will fail to serve the purpose.
So we can simply modify the "if" condition a bit to make it work on all cases. The condition will be like this:
if(!menu.contains(e.target) && !menuBtn.contains(e.target)) {...}
Thank you, great video friend!
Great help! Thank you
Thank you, a very great video friend!
Thank you for this is it so helpful
I was searching for this video very long and perfect explanation is bonus 🎉
Thank you 😊
Subscribed. Straight to the point. Thank you bro. I've been looking for this solution for over 2 days now
Subscribed, cool video
Thank you 😊
Great video, I recommend if you put the link for the github repo
Thank you. I have a video (ruclips.net/video/xcyfjHhMt28/видео.html) for a mobile menu in which I go over the "click outside" and the repo to that is: github.com/JonVadar/RUclips_videos/tree/main/Tips%20%26%20tricks%20videos/mobile_menu
what if i have multiple popups instead of just one?
what if i had multiple popups instead of just one?
Be honest not working without ajax cdn 😂😂😂😂lol