I just created a quiz in a xml file. I manage to make the hole code work properly. I'm now stuck at one point, how to make the quiz questions appear random? Bellow you can see one of the question in Javascript.
<!-- question 1 -->
<question id="q1" time="15" event="">
<box id="col1" position="relative" class="col-md-6" />
<box id="col2" position="relative" class="col-md-6" />
<text id="question1" position="relative" target="col1" x="0" margin-top="150" margin-bottom="40" anim="left" animtime="0.5"><![CDATA[<p class="p_24">What's my name?</p>]]></text>
<image id="fb1image" position="relative" target="col1" x="0" y="0" margin-bottom="30" anim="none" class="img-responsive"><![CDATA[lib/assets/c1.jpg]]></image>
<!--option 1 -->
<option correct="true">
<text id="option1_1" position="relative" target="col1" x="match" width="100%" margin-bottom="5" anim="left" animtime="0.5" animdelay="0.5" event="optionover,selectandsubmit" class="optionBox"><![CDATA[<p class="p_16 white">Pontus</p>]]></text>
</option>
<!--option 2 -->
<option correct="false">
<text id="option1_2" position="relative" target="col1" x="match" width="100%" margin-bottom="5" anim="left" animtime="0.5" animdelay="0.6" event="optionover,selectandsubmit" class="optionBox"><![CDATA[<p class="p_16 white">Peter/Bb</p>]]></text>
</option>
<!--/options -->
<!-- feedbacks -->
<fb id="pass" event="">
<box id="fb" position="relative" target="col2" margin-top="150" clear="both" anim="show" animtime="0.5">
<image id="passimage" position="relative" x="0" y="0" margin-bottom="30" anim="none" class="img-responsive"><![CDATA[lib/assets/c1_correct.jpg]]></image>
<text id="txt1" position="relative" anim="none" margin-bottom="30"><![CDATA[<p class="p_24">Correct!</p><p>My name is Pontus.</p><p>Good job!</p>]]></text>
<button id="nextQBtn" position="relative" width="150" margin-bottom="10" anim="none" event="btnover,loadNextQuestion"><![CDATA[Next]]></button>
<text id="bottompad" position="relative" anim="none"><![CDATA[<p> </p>]]></text>
</box>
</fb>
<fb id="fail" event="">
<box id="fb" position="relative" target="col2" margin-top="150" clear="both" anim="show" animtime="0.5">
<image id="failimage" position="relative" x="0" y="0" margin-bottom="30" anim="none" class="img-responsive"><![CDATA[lib/assets/c1_correct.jpg]]></image>
<text id="txt1" position="relative" anim="none" margin-bottom="30"><![CDATA[<p class="p_24">Wrong!</p><p>My name is Pontus.</p><p>Be careful!</p>]]></text>
<button id="nextQBtn" position="relative" width="150" margin-bottom="10" anim="none" event="btnover,loadNextQuestion"><![CDATA[Next]]></button>
<text id="bottompad" position="relative" anim="none"><![CDATA[<p> </p>]]></text>
</box>
</fb>
</question>
Aucun commentaire:
Enregistrer un commentaire