-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的问题(阵列数据在这里)方法的显示功能。
你必须添加一些你的尝试(即代码),否则人们继续向下投你的问题。 –