Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Great Script! Easy to implement! #3

Closed
inglesuniversal opened this issue Feb 28, 2019 · 3 comments
Closed

Great Script! Easy to implement! #3

inglesuniversal opened this issue Feb 28, 2019 · 3 comments

Comments

@inglesuniversal
Copy link

Hi, I was looking for a simple jquery solution... and I landed on your github page.

Great script. Simple to use and implement. KUDOS!!!

How can I implement adding a predefined number of points per question?

In my specific case. I have 40 questions and I want to assign a value of 2 points to the first 20, and a value of 3 points per correct answer to the remainder 20 questions (21 - 40).

Any quick way to accomplish this, without messing up your work?

Hope you can give me a hint.

Regards

@jchamill
Copy link
Owner

Thanks! Good to hear it is simple to use.

This is possible using callbacks. Callbacks provide the mechanism to add custom functionality. This does require a bit of javascript knowledge. I've added a new example for custom scoring in the demo directory [demo/custom-scoring.html]. Hopefully this example is enough to point you in the right direction.

@inglesuniversal
Copy link
Author

Thanks so much for your great script and valuable help as well.

The demo you kindly created, was exactly what I was looking for!

One last thing, I would like to add a small feature:

When the users clicks the right or wrong answer, I want to play a sound (e.g. correct.mp3 / incorrect.mp3 ), how can I locate the element or variable that handles that in order to trigger the sound using jquery or javascript (that part I have the code for), so all I need is how to get the element once the user has answered each question.

Regards.

@jchamill
Copy link
Owner

This is a very late response to your question and I hope you were able to figure it out. For what it's worth, you would use the same answerCallback function that is in the custom-scoring.html demo. There is an if statement that checks if the question was answered correctly. If it was, you put your javascript code to play the sound within that block. You would add an "else" clause to that statement to play an incorrect sound. Playing audio depends on your implementation/libraries/etc. Here is a link that may help: How to Play Audio.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants