-5
我正在嘗試進行幻燈片放映,並且我的想法是每隔5秒後切換幻燈片。要做到這一點,我想創建div並將它們存儲在一個包含所有內容的數組中,但我不知道如何做到這一點。將div及其所有內容存儲在數組中
更新:我能夠創建一個包含所有問題和答案選項的對象數組,然後使用.html()方法在對象中顯示數據。
var questions = [
{
quest: "Which of the following is an actual movie?",
answer: "A. Jaws",
choices: ["A. Jaws", "B. Laws", "C. Paws", "D. Claws"],
video: "<iframe width: 200px height: 100px src = 'https://www.youtube.com/embed/2I91DJZKRxs' allowfullscreen></iframe>"
},
{
quest: "Which of the following is an actual movie?",
answer: "B. For a Few Dollars More",
choices: ["A. Gummy Bears", "B. For a Few Dollars More", "C. What?", "D. I dont care"],
video: "<iframe width: 200px height: 100px src= 'https://www.youtube.com/embed/M-k_BW8iLkk' allowfullscreen></iframe>"
},
{
quest: "Which of the following is an actual movie?",
answer: "D. Pineapple Express",
choices: ["A. The Mining", "B. The Natrix", "C. Huh?", "D. Pineapple Express"],
video: "<iframe width: 200px height: 100px src='https://www.youtube.com/embed/8TUTxAK1EqQ' allowfullscreen></iframe>"
}
]
,然後我能夠使用setTimeout和調用我提出來切換使用。html的問題(陣列數據在這裏)方法的顯示功能。
你必須添加一些你的嘗試(即代碼),否則人們繼續向下投你的問題。 –