Giter Club home page Giter Club logo

magic-eight-ball's Introduction

Magic 8 Ball

The challenge:

This game is a fun implementation of the Magic 8 Ball game using HTML, CSS, JavaScript and jQuery. The player can ask any yes/no question, and the Magic 8 Ball will provide a mysterious answer.

screenshot

How to play

  • Click the "ask me anything" button
  • Type your yes/no question in the prompt that appears
  • Wait for the Magic 8 Ball to reveal the answer

Implementation details

The JavaScript code utilizes jQuery for DOM manipulation. Here's a brief overview of the key functionalities.

$(document).ready(function () {
  // Apply the 'shake' effect to the Magic 8 Ball
  $("#8ball").effect("shake");

  // Display the Magic 8 Ball answer with a fadeIn effect
  $("#answer").text(answer).fadeIn(3000);

  // Change the image of the Magic 8 Ball to indicate an answer is available
  $("#8ball").attr(
    "src",
    "https://s3.amazonaws.com/media.skillcrush.com/skillcrush/wp-content/uploads/2016/09/answerside.png"
  );

  // Hide the answer initially
  $("#answer").hide();

  // Attach a click event handler to the question button
  $("#questionButton").click(onClick);
});

Resources

jQuery official website

magic-eight-ball's People

Contributors

codercreative 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.