Build a Popup With JavaScript

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 เม.ย. 2019
  • If you have used the web anytime in the last 5 years then you have most definitely run into an abundance of popups, also known as modals, which are quickly becoming one of the most popular components in web development.
    In this video I will cover how to create a simple modal that animates in on button click, and fades out when the modal is closed. This modal is also able to be closed by clicking anywhere outside the modal which is something most tutorial don't cover. Lastly, this modal is setup in a way that it is incredibly easy for you to customize it to the needs of your exact website.
    📚 Materials:
    Code: github.com/WebDevSimplified/V...
    🧠 Concepts Covered:
    - How to use transform translate to center elements
    - How to show/hide elements with a button click
    - Smooth open/close animation transitions
    - How to style an ugly modal 😜
    - CSS position fixed
    - Using CSS pointer events to prevent click events
    🌎 Find Me Here:
    Twitter: / devsimplified
    GitHub: github.com/WebDevSimplified
    CodePen: codepen.io/WebDevSimplified
    #JavaScript #WebDevelopment #Modal

ความคิดเห็น • 321

  • @nikhilsharma2982
    @nikhilsharma2982 4 ปีที่แล้ว +23

    Hi, your way of explaining the each and every details and your approach of covering every dependent elements which are being used or going to be affected in the background is simply awesome.
    Thanks a lot for covering it in a speedy but with a very simplified way.

  • @BMikel
    @BMikel 3 ปีที่แล้ว +6

    This is most comprehensive and straightforward tutorial on modals I've ever seen. What makes it unique - handling multiple modals. Most of TH-cam educators show only how singular modal works.

  • @glensrb4723
    @glensrb4723 5 ปีที่แล้ว +40

    Perfect timing! Was looking for a modal solution to a login form and this is just perfect. Thanks mate! :)

  • @dan1523
    @dan1523 4 ปีที่แล้ว +20

    Hey bro, I just wanna say that Your vids have really helped me understand some concepts that I had a hard time grasping in my bootcamp. keep up the great vids!

  • @ryand640
    @ryand640 4 ปีที่แล้ว +57

    Seriously strong video... concise, well paced, extremely well organized and well presented . Great job!

    • @f44nboy
      @f44nboy ปีที่แล้ว +2

      Nothing to add to that!

  • @masterofnan2870
    @masterofnan2870 4 ปีที่แล้ว +2

    Dude, you rule. I have been pulling my hair out trying to deal with other modal methods. Thank you!

  • @MRAMetharam
    @MRAMetharam ปีที่แล้ว +1

    This content is golden! Not only is it short and direct to the point, but it also shows off a lot of very useful techniques! It is very seldom that I come across videos like this! Thanx for being awesome and sharing this!

  • @timderks5960
    @timderks5960 2 ปีที่แล้ว +1

    Kyle, your videos are a true lifesaver. I'm a pretty good coder - for a hobbyist at least, but my CSS knowledge is pretty basic. Because of this, I used to have some complex functions to handle button clicks on elements that have children, since the target of the event can be either the clickable element, or one of its children. If only I knew about pointer-events sooner, that could have saved me so much time!
    There's a lot of great JS and CSS content out there, but in the last couple of years, I've always come back to your videos. Thanks for all the effort!

  • @masterchief9148
    @masterchief9148 ปีที่แล้ว

    Honestly, you're my favorite dev youtuber !
    Each details are explained extremely well and without search your word !

  • @Fatfingertunes
    @Fatfingertunes 3 ปีที่แล้ว +4

    Excellent! And far more sophisticated than I would have done myself... really appreciated.

  • @danbuild977
    @danbuild977 3 ปีที่แล้ว +2

    Absolute Fire in 15 minutes. Your videos are incredible, and super easy to follow. Thank you.

  • @thedesignerdeveloper8205
    @thedesignerdeveloper8205 4 ปีที่แล้ว +1

    Thank you for the tutorial! I just subscribed so I'll definitely be watching more of your tutorials.

  • @juicifer2024
    @juicifer2024 ปีที่แล้ว

    im not joking when i say you have taught me more about web development than any college programming course did. Thank you for teaching the public in a very clear concise way.

  • @bonguthandokhumalo7552
    @bonguthandokhumalo7552 3 ปีที่แล้ว

    Thanks a lot, man, your videos are always helpful. Keep up the good work.

  • @jaydenmoon1165
    @jaydenmoon1165 2 ปีที่แล้ว

    That was an awesome tut as always! - lol needed a refresher on this topic, thank you !

  • @adamjamiu6764
    @adamjamiu6764 3 ปีที่แล้ว

    Thanks, kyle. I don't know how I will appreciate your efforts. you made me understand how I will put my javascript skills into real-world projects

  • @mattmelester8929
    @mattmelester8929 ปีที่แล้ว

    Another great job (as usual). Thanks.

  • @greenfigure3941
    @greenfigure3941 4 ปีที่แล้ว +2

    Thank you! I was looking for something like this and you helped me really much with my popup for my chrome/firefox extension. Without you, I would have skipped it completely and only used boring html headers inbedded in the site which would've looked awful and barely worked.

  • @leochannel1189
    @leochannel1189 4 ปีที่แล้ว

    Thank you so much! You helped a lot and explained perfectly!

  • @grownmancrying
    @grownmancrying 4 ปีที่แล้ว +1

    Man you rock! Thanks again for this one. Keep up the great work!

  • @katkodes6055
    @katkodes6055 ปีที่แล้ว

    You have the best videos! So grateful

  • @JacoblBroughton
    @JacoblBroughton 4 ปีที่แล้ว

    Thank you so much, man. Great, informative tutorial.

  • @Aweheid
    @Aweheid 2 ปีที่แล้ว

    Wow! your way of teaching is amazing! it's straightforward, explains everything directly in short words, is well presented, prepared, and very very clean and organized. Thanks, many many thanks.

  • @xylesx
    @xylesx 4 ปีที่แล้ว +1

    Love this! Thank you for this. ;) Learned a bunch.

  • @abhirammadhu2973
    @abhirammadhu2973 2 ปีที่แล้ว

    This is so perfect and well explained. All the modal popups that I have check, they make it over complicated.

  • @shvideo1
    @shvideo1 3 ปีที่แล้ว

    A great behaving modal and great technique as well. Great job. Thank you.

  • @dannyezechukwu1175
    @dannyezechukwu1175 9 หลายเดือนก่อน

    Great video. This helped me a ton! This channel is awesome!

  • @twoonswig3667
    @twoonswig3667 11 หลายเดือนก่อน

    I've just gone mental trying to do this using stack, gpt and other videos. Gonna have some trouble with databases trying to get the modal to reflect the information relevant to which image was clicked but hopefully a bit of python can sort it out. You're such a good creator, 10 stars

  • @lukabubnjevic5126
    @lukabubnjevic5126 3 ปีที่แล้ว

    exactly what i was looking for!

  • @sarvij9870
    @sarvij9870 ปีที่แล้ว +1

    You are the best, awesome explanation, step by step , ty

  • @MYount
    @MYount 3 ปีที่แล้ว +1

    the official Kyle pop up. I got so much from this video thanks. I love the way you popped up in the beginning. lol

  • @oscarleon3008
    @oscarleon3008 3 ปีที่แล้ว

    Just what I need, perfect!

  • @alexjulius69
    @alexjulius69 2 ปีที่แล้ว

    Yes! This is precisely what I need for my software, thanks

  • @sanjaymahto5825
    @sanjaymahto5825 3 ปีที่แล้ว

    You are justifying the name of this channel. thanks 🙏

  • @stratokrat6290
    @stratokrat6290 4 ปีที่แล้ว +1

    High quality content. Well done and thank you!

  • @roanmaravillo9895
    @roanmaravillo9895 3 ปีที่แล้ว

    Thanks kyle you really helped me on my project looking for a carousel tutorial in the future.

  • @thmasibsirinzad3693
    @thmasibsirinzad3693 5 ปีที่แล้ว

    Thank you for sharing this code. i have been searching modal pop code for a long time, finally i found what i wanted

  • @gindevgin9298
    @gindevgin9298 3 ปีที่แล้ว

    i really love your contents! thanks!

  • @ismailmunyentwari3752
    @ismailmunyentwari3752 ปีที่แล้ว

    Thank you bro 👊....
    I was wondering the way I will create my own modal without
    Bootstrap.
    But now you turned me to it .

  • @oteror
    @oteror ปีที่แล้ว

    Great tutorial! Easy to follow.

  • @Ai4698
    @Ai4698 ปีที่แล้ว

    I tried it by myself at first but yours looks so much better. Also never heard of data-* until this video

  • @alanrobbo6980
    @alanrobbo6980 2 ปีที่แล้ว

    This is Fantastic, Thank You.👍

  • @markroyacebuche9829
    @markroyacebuche9829 4 ปีที่แล้ว

    thank you for this tutorial it really helps

  • @pixelum2023
    @pixelum2023 ปีที่แล้ว

    Very interesting! I'll definitely incorporate that into some of my projects!

  • @DejanPavlovic-tu8vj
    @DejanPavlovic-tu8vj ปีที่แล้ว

    Thank you so much,so much i learned from this video.. Thank you again! Hope one day ill make this easy like you... Thanks !!!!

  • @juangabriel2559
    @juangabriel2559 3 ปีที่แล้ว

    Great video bro, thank you!

  • @naie_1001
    @naie_1001 2 ปีที่แล้ว

    you are a lifesaver, thank you so much!!

  • @ben8140
    @ben8140 ปีที่แล้ว

    Great tutorial!

  • @cronopios20
    @cronopios20 4 ปีที่แล้ว

    Awesome! Thank you

  • @SH-lt2iv
    @SH-lt2iv 4 ปีที่แล้ว

    Very good tutorial learned alot thanks!

  • @bonganimkhaliphi8695
    @bonganimkhaliphi8695 3 ปีที่แล้ว

    Excellent Tut. Enjoyed it very much

  • @gagiknavasatariyan7316
    @gagiknavasatariyan7316 3 ปีที่แล้ว

    It is really helped me. Great work

  • @pascalgoldmann6429
    @pascalgoldmann6429 2 ปีที่แล้ว

    Thank u my friend! Very Strong tutorial

  • @jjwebb15
    @jjwebb15 2 ปีที่แล้ว

    Came here for the modal turotial, left with a lorem shortcut. Gotta love it!

  • @PiotrSygutPL
    @PiotrSygutPL 2 ปีที่แล้ว +1

    Great job - thanks 👍

  • @MickenCZProfi
    @MickenCZProfi 3 ปีที่แล้ว +2

    Thanks, this is very helpful and simple to understand. A lot of the code can be avoided if you are triggering the popup on some event and not a button (in my case when you lose in the game).

  • @MASHOfficial
    @MASHOfficial 4 ปีที่แล้ว

    lovely video, helped me a lot

  • @win_ini
    @win_ini 3 ปีที่แล้ว

    7.8 billion people should be subscribed to you

  • @wickedgabrugamer
    @wickedgabrugamer 4 ปีที่แล้ว

    love your explanation man..

  • @ahndeux
    @ahndeux 2 ปีที่แล้ว

    Holy moley. That is a lot of work to create a modal.

  • @latinwarrior01
    @latinwarrior01 3 ปีที่แล้ว

    Excellent code sample and explanation! Thanks for putting this video together. I will subscribe to your channel.

  • @lazarzbiljic4903
    @lazarzbiljic4903 2 ปีที่แล้ว

    OMG... you save my life bro, tnx!

  • @red1io
    @red1io 2 ปีที่แล้ว

    great tuto. thank you

  • @gifbfbvhvhdhfhfjffjfnfhfb515
    @gifbfbvhvhdhfhfjffjfnfhfb515 2 ปีที่แล้ว

    bes tutorial ive ever seen and you show the code when youve done . ill give you a cheeky sub

  • @nasirsheikh1434
    @nasirsheikh1434 3 ปีที่แล้ว

    Awesome. Thank you

  • @codedropsjs9633
    @codedropsjs9633 3 ปีที่แล้ว

    that is what I was looking for

  • @failking888
    @failking888 3 ปีที่แล้ว

    mAAAAn, thx I'm making the project and had some troubles and ur video solved it, big thx u)))

  • @michi19935
    @michi19935 4 หลายเดือนก่อน

    Thanks so much!

  • @jivanmainali1742
    @jivanmainali1742 4 ปีที่แล้ว +2

    Bro pointer-event :none does make everything insensitive to touch or click event but when you use this property it is able to click a button and if we use z-index instead of event-pointer then still button is non clickable .why?

  • @romuloalves9349
    @romuloalves9349 4 ปีที่แล้ว

    Ótimo vídeo era oque eu estava precisando obrigado.

    • @jamespawson6045
      @jamespawson6045 3 ปีที่แล้ว

      Great video! It's what I needed, thanks - just a quick translation if he needed it.

  • @siddarthkotthur1558
    @siddarthkotthur1558 4 ปีที่แล้ว +1

    bro u deserver million more subscribers!

  • @daalwada
    @daalwada 4 ปีที่แล้ว

    You can build bootstrap v6.0 alone.. popup, accordions, this and that.. and you have no idea how much knowledge you have man! 😄

  • @patrickmarschke2901
    @patrickmarschke2901 3 ปีที่แล้ว

    Thanks so much for this! Very clear :)
    Any suggestions on how to have the content inside the modal be pulled from somewhere besides the HTML upon a click event? Like a dynamically loaded footnote (or something like that).

  • @silverbell6160
    @silverbell6160 2 ปีที่แล้ว +1

    Wow! I looked for something like this all afternoon. I have some modals that i need to close programatically ! All i found was jquery options. I wanted to use vanilla js. Thank u! Well explained, to the point.. great ⭐⭐⭐⭐⭐

  • @israelthewhite4863
    @israelthewhite4863 ปีที่แล้ว

    Thanks, you are the best

  • @JorgeRivera-rp1zw
    @JorgeRivera-rp1zw 2 ปีที่แล้ว

    tHANKS TO SHARE THIS VIDEO WAS AWESOME..!
    AND VERY USEFULL..! PLEASE DO IT MORE...! SUCCEEDS..!

  • @CarlosSilva-uj6un
    @CarlosSilva-uj6un 2 ปีที่แล้ว

    thank you very much!

  • @backToFreedom
    @backToFreedom 4 ปีที่แล้ว

    Perfect!

  • @GavinWoodthebarbarian
    @GavinWoodthebarbarian 3 ปีที่แล้ว

    this is awesome, exactly what I was looking for. I do have a question though, if I have a button inside the modal that triggers another modal (so the white section replaces each other - Bootstrap uses the data-dismiss data-toggle) but the overly stays. how do I go about this?

  • @0119325
    @0119325 4 ปีที่แล้ว +1

    If we create two modal buttons the functions does respond to eachone so that's the purpose of selector forEach?

  • @user-se6ct5zu2f
    @user-se6ct5zu2f 2 ปีที่แล้ว

    thank you so much!!!

  • @V.Z.69
    @V.Z.69 4 ปีที่แล้ว +72

    Pretty good. It just drives me crazy that you didn't use a single semicolon in JS.

    • @foxjonesofficial
      @foxjonesofficial ปีที่แล้ว +3

      I don’t use semicolons😊

    • @abhilashLeader_07
      @abhilashLeader_07 ปีที่แล้ว

      I use but it is not mandatory....i dont know y 🤣🤣🤣

  • @viktorshatalov1920
    @viktorshatalov1920 4 ปีที่แล้ว

    Очень классно и понятно!!!спасибо. Cool!!! thank you

  • @jaymishra7560
    @jaymishra7560 3 ปีที่แล้ว

    Great Describing !

  • @bikramchettri9405
    @bikramchettri9405 5 ปีที่แล้ว +1

    Thanks mate. Your tutorials are precious. If you can do a video on throttling and debounce it will be very helpful.

    • @WebDevSimplified
      @WebDevSimplified  5 ปีที่แล้ว +2

      I'm really glad my videos help. Debounce is a fairly technical and advanced topic, which I generally believe is done better through text. That said, I will look into seeing if I can figure out a good way to teach that concept through video.

    • @bikramchettri9405
      @bikramchettri9405 5 ปีที่แล้ว

      @@WebDevSimplified Thanks for the reply.

  • @UwU-dx5hu
    @UwU-dx5hu 3 หลายเดือนก่อน

    Thank you so so so much

  • @ileska7828
    @ileska7828 2 ปีที่แล้ว

    Thank you so much sir

  • @philipweidmann4262
    @philipweidmann4262 3 ปีที่แล้ว

    good one!

  • @robertoenriquechavezrodrig731
    @robertoenriquechavezrodrig731 4 ปีที่แล้ว

    Thanks bro you're a badass :)

  • @hd51547885
    @hd51547885 2 ปีที่แล้ว

    Really Good

  • @shazbaz5695
    @shazbaz5695 4 ปีที่แล้ว

    Hi, just wondering do you have to have the modal on the same page as the button? What if you want a navigation bar across different pages and one reusable login/register form modal and not copy and paste the modal on every page...how would you get around that?

  • @aram5642
    @aram5642 3 ปีที่แล้ว

    The modal dialogs are complex matter on various levels (template abstraction, vertical scrolling, responsiveness, focus, tabindex, etc), but this tutorial is a good starting point. Never ever though remove css outlines from focusable elements - for the sake of accessibility.

  • @user-rt4gn7rh5s
    @user-rt4gn7rh5s 3 ปีที่แล้ว

    Thanks a lot

  • @detoxfi5926
    @detoxfi5926 ปีที่แล้ว

    Thank you for the great video. can you make a video explaining how to get those pop-up triggers such as time and intent to exit

  • @buzzyso
    @buzzyso 2 ปีที่แล้ว

    THANK YOU

  • @okoliginikachukwu6036
    @okoliginikachukwu6036 4 ปีที่แล้ว +3

    Pretty straightforward and beginner friendly. Great job!
    Only issue I'm having is that the modal is triggered on page load instead of on button click. Pls what should I do

  • @aufantaufiqurrahman2794
    @aufantaufiqurrahman2794 8 หลายเดือนก่อน +1

    alhamdulillah, thank u very much!

  • @kurtcamarines9481
    @kurtcamarines9481 3 ปีที่แล้ว +1

    Any clue how to loop through all the other button and close the active ones before opening a new one?

  • @KeeveSinger
    @KeeveSinger 2 ปีที่แล้ว

    Awesome explanations! Quick question. What is the 'live server' you were referring to? How can I use it?

  • @yugeshkk3062
    @yugeshkk3062 3 หลายเดือนก่อน

    Thank you