DiscoverSyntax - Tasty Web Development TreatsModals, Popups, Popovers, Lightboxes
Modals, Popups, Popovers, Lightboxes

Modals, Popups, Popovers, Lightboxes

Update: 2023-04-171
Share

Description

In this Hasty Treat, Scott and Wes talk through the differences between modals, popups, popovers, lightboxes, and dialog boxes.

Show Notes

const showButton = document.getElementById('showDialog'); const favDialog = document.getElementById('favDialog'); const outputBox = document.querySelector('output'); const selectEl = favDialog.querySelector('select'); const confirmBtn = favDialog.querySelector('#confirmBtn');  // "Show the dialog" button opens the <dialog> modally showButton.addEventListener('click', () => {     favDialog.showModal(); }); // "Favorite animal" input sets the value of the submit button selectEl.addEventListener('change', (e) => {   confirmBtn.value = selectEl.value; }); // "Confirm" button of form triggers "close" on dialog because of [method="dialog"] favDialog.addEventListener('close', () => {   outputBox.value = `ReturnValue: ${favDialog.returnValue}.`; }); 

Tweet us your tasty treats

Comments 
00:00
00:00
x

0.5x

0.8x

1.0x

1.25x

1.5x

2.0x

3.0x

Sleep Timer

Off

End of Episode

5 Minutes

10 Minutes

15 Minutes

30 Minutes

45 Minutes

60 Minutes

120 Minutes

Modals, Popups, Popovers, Lightboxes

Modals, Popups, Popovers, Lightboxes