Giter Club home page Giter Club logo

weirdfacts's Introduction

Weird Facts Quiz

This website is aimed at people that love to learn weird and mostly unusual facts for fun! I got the idea from a friend that likes to give a random fact of the day every time we meet, it always makes me laugh... and doubt the fact to the point that I have to get on google and check it out for myself. My goal is to create a functioning quiz using html, CSS and JavaScript that is responsive and fun for all people that have an interest in learning weird facts.

Click here to go to the live website!

Live website image

Table of contents

  1. User Expectations
  2. Wireframes
  3. Features
  4. Changes from the original plan
  5. Testing
  6. Deployment
  7. Finished product
  8. Credits

User Expectations

  • As a user, I want see a site that is clearly laid out.
  • As a user, I want clear instructions of how the quiz works.
  • As a user, I want the site to be interactive.
  • As a user, I want to be able to navigate through the quiz easily.
  • As a user, I want the site to be responsive on multiple devices.

Wireframes

Start

wireframe for starting page

Instructions

wireframe for instructions page

Feedback

wireframe for the feedback page

Quiz

wireframe for the quiz section

Results

wireframe for the page shown when at the end of the quiz

Mobile wireframes

wireframe for start page instructions and feedback form if they are on a mobile device

wireframe for questions and results if they are on a mobile device

Features

Logo

  • I created the Weird Facts Quiz logo on procreate. I wanted a logo that would go well with the rest of the quiz. I had decided on using a font called 'Special Elite' for my quiz to make it look like it had been written on a typewriter, so I drew my logo with that in mind.

image of logo on website

The start area

  • This is the first page you see when the quiz loads. On this page there are three options, the first option being the instructions, second being start which activates the quiz itself and the last option being Give feedback. Each of these options when clicked on will take you to their corresponding pages.

image of the start area on website

The score area

  • The score area is shown at the bottom of the page, this is here so that the user can see how many questions they have got correct and how many are incorrect throughout the quiz.

image of the score area on website

Instructions area

  • The instructions area is shown when instructions is clicked on the start page, it contains three simple instructions explaining how the quiz works followed by an exit button that will take you back to the start area.

image of the instructions area on website

Feedback area

  • This area is a place where users can leave feedback or even other weird facts. They can do this by entering their text into the form and pressing submit underneath. There is also an exit button that will again take you back to the start area.

image of the Feedback area on website

Quiz area

  • The quiz area is the space in which the questions are asked, and the user gives their answers. It consists of a question at the top and 4 answer choices. when the user clicks on a choice their choice will light up either red or green depending on if the answer they chose was correct or not. once a choice is made the score area underneath will be adjusted and the next button will pop up at the bottom under the answer choices. When the next button is pressed it will move onto the next question.

image of the quiz area on website

  • When the user gets to the last question, the next button will be an end button instead as there will be no more questions for the user to answer. When they click on the end button is will take them onto one of two result sections.

image of the quiz area with end button on website

Results sections

  • When the user gets to the end of the quiz, they will see either the congrats area if they get 5 or more questions correct, or they would see the try again area if they got less than 5 correct. These areas both have a little message to the user followed by a restart button that will reset the whole quiz and take them back to the start area.

image of the congrats area on website

image of the try again area on website

Changes from the original plan

  • Originally, I had planned it out so that when the user clicks on an answer it will turn red or green depending on if they get it correct or not. I wanted to be able to teach the user the correct answer if they didn't get it right, so I added a function to allow the correct answer to also show if the user doesn't guess right.

image of the quiz area when wrong answer is clicked

Testing

HTML

HTML was tested using the official W3C validator

The HTML results came back with no errors. The following warnings were found:

image of warnings

  • All warnings were showing empty headings. This is because they were left empty to allow different words to be placed inside the headings throughout the quiz using JavaScript.

CSS

CSS was tested using the official (Jigsaw) validator

No errors were found in the CSS:

CSS test showing no error

JavaScript

JavaScript was tested using js hint js hint validator

The JavaScript results came back with the following:

image of errors

  1. A warning for a missing semicolon on line 96
  • To resolve this, I went to line 96 and placed the semicolon where needed.
  1. It found two undefined variables, congrats on line 143 and tryAgain on line 146.
  • For both I wrote a variable using getElementById to pull them from the html.
  1. It found three unused variables, choices on line 20, restartBtn on line 27 and restart on line 153.
  • Choices was not needed so it was deleted.
  • As restart is a function, and in the html I had onclick="restart(); the restartBtn variable was not needed so this was also deleted.

The JavaScript was then retested, it came back with nothing but the one unused variable 'restart', this is because it didn't pick up that it was used as an onclick function within the html.

Manual Testing

Component Function Does it work? Fixed?
Start area: Instructions Takes user to instructions area Yes N/A
Start area: Start Takes user to quiz area Yes N/A
Start area: Give feedback Takes user to feedback area Yes N/A
Instructions: Exit Takes user back to start area Yes N/A
Feedback: Exit Takes user back to start area Yes N/A
Feedback: Submit Submits users feedback Yes N/A
Quiz: Answer buttons change color to red/green depending on if answer is correct or not, implement score, show the next button Yes N/A
Quiz: Next change color of all answer buttons back to white, show the next question/answers Yes N/A
Quiz: End shows results section congrats if user scored 5+ or try again if user scored less than 5 Yes N/A
Congrats: Restart resets score area and takes user back to start area Yes N/A
Try again: Restart resets score area and takes user back to start area Yes N/A

I also carried out manual testing which tested the responsiveness of the website. I have tested my site on the following devices:

  • Moto G4
  • Galaxy S5
  • Pixel 2
  • iphone 5/SE
  • iphone 6/7/8
  • iphone 6/7/8 Plus
  • iPad
  • ipad pro
  • Desktop

Bugs

  1. I found that when the user chose an answer, there seemed to be no limit on how many times they can make a choice on the same question before pressing the next button and therefore could add as many correct and incorrect points as they like on each question.
  • fixed? Yes

  • what did I do?

    To fix this I had to find a way to disable all choices when a user makes their first choice on each question. To do that I created a variable called answerDisable and gave it the value of false to start with. In the function where I added a selected class to the choice the user selected, I added an if statement that says if answerDisabled is equal to true then return null. The null value removes and values the choice objects had disabling the use of them. right after the if statement in the userAnswer function I wrote answerDisable = true to put that if statement into use. In the show next question function, when the next button is pressed, I put answerDisabled = false to allow the use of the choice buttons again for the next question.

  1. I found that when a user scores 10/10 on devices with a screen around 360px, the score area goes to block rather than inline.
  • fixed? Yes

  • what did I do ?

I realised this was because by getting 10 rather than 9 or below there are two digits in the number. This meant that both correct and incorrect scores could no longer fit on the same line. To fix it all I needed to do was lower the font size slightly.

Screenshot of the bug

Deployment

The site was deployed to GitHub pages.

The steps to deploy are as follows:

  • First, I created a new repository by clicking new in the GitHub repository menu
  • I used the Code-institute-Org/gitpod-full-template and created a repository name.
  • I continued by clicking in the create repository button at the bottom of the page.
  • When it had been created, I then went to settings.
  • Scrolled down to Github pages where it says "Pages settings now has its own dedicated tab! Check it out here!" And I followed the link.
  • When on Github pages I selected the source to be the main branch and pressed save.
  • A message then pops up that says, " Your site is ready to be published at Your site is published at https://et9719.github.io/weirdFacts/ and when clicked on will take you to the site.

Finished product

Home page: Screenshot of the Home page

Instructions: Screenshot of the instructions

Feedback page: Screenshot of the feedback page

Questions page: Screenshot of the questions page

Questions page when user selects correct answer: Screenshot of the questions page when user selects correct answer

Questions page when user selects incorrect answer: Screenshot of the questions page when user selects incorrect answer

Questions page on the last question: Screenshot of the questions page on the last question

Results when user gets 5 or more correct: Screenshot of the results page when user wins

Results when user gets less than 5 correct: Screenshot of the results page when user loses

Credits

Content

  1. https://gitpod.io/workspaces and https://github.com/ : were used to create the site

  2. I watch multiple videos on YouTube to help me get an idea of how to make the quiz, here are some of the videos I got inspiration from: Build A Quiz App With JavaScript, web dev simplified How to Make a Quiz App using HTML CSS Javascript - Vanilla Javascript Project for Beginners Tutorial, Brian Design How To Make Quiz App With Timer Using HTML CSS & JavaScript, Code Now

  3. Id also like to thank my mentor Marcel and also other students like Matt Bodden for their support and encouragement throughout this project.

Media

  1. https://uizard.io/ : This was used to create the wireframes used to design the site.

  2. Procreate : This app was used to make the weird facts logo.

  3. https://stock.adobe.com/ : This is where I found the image of paper for the container.

weirdfacts's People

Contributors

et9719 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.