2016-09-28 3 views
-2

Ich versuche, ein einfaches browserbasiertes Quiz zu machen, das ein Bild als Frage- und Textantworten hat oder umgekehrt (es ist ein Zeichensprachenquiz) und ich fand eine Quizvorlage online, die gut zu funktionieren scheint, aber dafür das Leben von mir Ich habe keine Ahnung, wie man ein Bild zu der Frage hinzufügt.Wie kann ich meiner JavaScript/JQuery-Datei ein Bild hinzufügen?

Code: http://codepen.io/jchamill/pen/garoqg

JS-Code:

$('#quiz').quiz({ 
    //resultsScreen: '#results-screen', 
    //counter: false, 
    //homeButton: '#custom-home', 
    counterFormat: 'Question %current of %total', 
    questions: [ 
    { 
     'q': 'Is jQuery required for this plugin?', // This is where I'd like the photo to be. 
     'options': [ 
     'Yes', 
     'No' 
     ], 
     'correctIndex': 0, 
     'correctResponse': 'Good job, that was obvious.', 
     'incorrectResponse': 'Well, if you don\'t include it, your quiz won\'t work' 
    }, 
    { 
     'q': 'How do you use it?', 
     'options': [ 
     'Include jQuery, that\'s it!', 
     'Include jQuery and the plugin javascript.', 
     'Include jQuery, the plugin javascript, the optional plugin css, required markup, and the javascript configuration.' 
     ], 
     'correctIndex': 2, 
     'correctResponse': 'Correct! Sounds more complicated than it really is.', 
     'incorrectResponse': 'Come on, it\'s not that easy!' 
    }, 
    { 
     'q': 'The plugin can be configured to require a perfect score.', 
     'options': [ 
     'True', 
     'False' 
     ], 
     'correctIndex': 0, 
     'correctResponse': 'You\'re a genius! You just set allowIncorrect to true.', 
     'incorrectResponse': 'Why you have no faith!? Just set allowIncorrect to true.' 
    }, 
    { 
     'q': 'How do you specify the questions and answers?', 
     'options': [ 
     'MySQL database', 
     'In the HTML', 
     'In the javascript configuration' 
     ], 
     'correctIndex': 2, 
     'correctResponse': 'Correct! Refer to the documentation for the structure.', 
     'incorrectResponse': 'Wrong! Do it in the javascript configuration. You might need to read the documentation.' 
    } 
    ] 
}); 
+0

Stackoverflow soll Ihnen helfen, wenn Sie keine Lösung trotz allem ausprobieren können, müssen Sie Front-End-Web-Entwicklung dafür lernen. Es ist eine ziemlich einfache. bitte durch die jeweiligen Tutorials gehen – wallop

Antwort

0

Sie müssen blechen und das Plugin selbst zu ändern. Sie möchten in src/jquery.quiz.js suchen und die setup Funktion ändern. speziell der Teil zwischen Zeile 68 und 79:

Verwandte Themen