side-menu and modal with Javascript

 

Image for post

This is the course content from Brad Traversy.

Not much javascript code though, but it’s really useful.

Github code

TML

Image for post

the header includes a toggle button, a title, a paragraph and a sign-up button

Image for post

the container is just some random words in the demo

Image for post

nav is the side menu content including a logo and an unsorted list

Image for post

modal is the box of sign-up within a form and a close button

SS

the main CSS to remind

Image for post

first, hide the nav to the left side of the screen with transform

When showing the nav, transition happens moving to the right side with the length of the nav.

Image for post
Image for post

first, hide the modal before clicking the sign-up button.

modal with the animation opacity setting

S

Image for post

all the DOMs needed

Image for post

When clicking the toggle menu button, the show-nav added(changing the position of nav)

Image for post

When clicking the Sign-up button, modal show up( changing the display and opacity)

When clicking the close button in modal, modal hides(hiding the display and opacity)

Image for post

When clicking the outside of the modal, closing the modal the same way. If clicking on the modal, it won’t work.

Popular posts from this blog

Fancyapps — easily build overlay windows with carousel

Meet Mantine: A TS-Based Open-Source React Components Library

Thoughts about Progressive Web App