feat: show pic when game start
This commit is contained in:
parent
5c92ceffbc
commit
04621cf3ab
29
js/game.js
Normal file
29
js/game.js
Normal file
@ -0,0 +1,29 @@
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
// Function to show an element
|
||||
function showElement(selector) {
|
||||
const element = document.querySelector(selector);
|
||||
if (element) {
|
||||
element.style.display = 'block';
|
||||
}
|
||||
}
|
||||
|
||||
// Function to randomly select a customer
|
||||
function showRandomCustomer() {
|
||||
const customers = ['#customer1 img', '#customer2 img', '#customer3 img'];
|
||||
const randomIndex = Math.floor(Math.random() * customers.length);
|
||||
showElement(customers[randomIndex]);
|
||||
}
|
||||
|
||||
// Show all dishes
|
||||
showElement('#mapo-tofu img');
|
||||
showElement('#roast-duck img');
|
||||
showElement('#yangzhou-fried-rice img');
|
||||
showElement('#braised-prawns img');
|
||||
showElement('#kung-pao-chicken img');
|
||||
|
||||
// Show a random customer
|
||||
showRandomCustomer();
|
||||
|
||||
// Show normal Qin Shi Huang
|
||||
showElement('#qinshihuang img');
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user