bf-quiz | Buzzfeed style quiz generator | Learning library
kandi X-RAY | bf-quiz Summary
kandi X-RAY | bf-quiz Summary
Buzzfeed style quiz generator
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of bf-quiz
bf-quiz Key Features
bf-quiz Examples and Code Snippets
Community Discussions
Trending Discussions on bf-quiz
QUESTION
The following is the full JavaScript code for a quiz. It works perfectly on desktop browsers. However, when I went to test it on my phone, it doesn't work.
Mobile loads the JSON quiz, but after all the answers are selected, it does not freeze all the selected answers and display the results. Instead, nothing happens, no result is shown/calculated, and the user can continue to select answers.
I'm not experienced with JavaScript on Mobile and don't know what is causing the problem.
I've deleted a few parts of the code that simply appended html in order to cut down on size.
You can view it here: plnkr.co/edit/tkCQVxoIq9oOiApeUY66?p=preview
...ANSWER
Answered 2017-Mar-07 at 00:41If you ever try to see console log on a mobile device, you might notice that there is a JavaScript error because iOS Safari is less forgiving than whatever desktop browser you use. Particularly it is illegal to set style
property of HTMLElement
as string in strict
mode. You may see examples of the ways to set it properly at https://developer.mozilla.org/en/docs/Web/API/HTMLElement/style If you fix this issue, code seems to be working on Mobile Safari as well.
P.S. note that the offending code is missing in your question and is only visible in the full code of writeResult
on plunker. This is why it is so important to provide a Minimal, Complete, and Verifiable example
QUESTION
I'm trying to build a javascript quiz that isn't "right" or "wrong," but gives an output on a scale. These quizzes are for personal taste, personality, etc. So, "What superhero are you?"
I've been trying to use this JSON/Javascrpt here: https://github.com/jbierfeldt/bf-quiz/blob/master/bf-quiz.js
I'm really hung up on the calcResult. I've been trying to debug it, and I can't figure out what its doing. Is it keeping track of a highest number of an individual group highest
and then only modifying highest_score
when something larger comes up? I can't figure out how the output of this aligns with a defined number result answer.
ANSWER
Answered 2017-Jan-23 at 21:44It's pretty straightforward. I added (slightly generic) comments to the code for you.
What it does is find the result that most users have picked as an answer (whatever a result is in your use case).
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install bf-quiz
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page