movie seat booking with Javascript
Movie seat booking course from Brad Travacy.
Fetures:select option value in html
perspective in css
changeing color of seats when click available seats
seats number and price from localStorage
HTML
there are 5 rows and each row contains 8 seats.total is 40 seats.
CSS
the select with appearance none: without error shape.And for different browser using, apply -moz and -webkit.
set the space between the first two coloum and the last two which is the aisle.
when hovering the seat, scale the size.
set the container toperspective:1000px. the shape of screen rotated 3d.
set the container toperspective:1000px. the shape of screen rotated 3d.
JS
and run the updateSelectedCount()
all the selectedSeats is the NodeList. So it's better to map the seats to get the index of seat(index).And storage the index into local storage
NodeList.length is the seats' length.
Then pass the number and price into DOM.
Also update the count again.
When refresh teh page, the UI should show the data get from localStorage.
if something in it,loop every seat index and add the occupied class.And also show the selected movie inde and price.
run the populateUI() and updatedCount() when load the page.
run the populateUI() and updatedCount() when load the page.
More:
Array.indexOf():the outcome is a number.First is 0. MDN
ElementNode.classList.add() and also remove,toggle and so on . MDN
When select all the seats DOMs, there is a NodeList.For convient loop,using [...] to convert to array.