GithubHelp home page GithubHelp logo

amenakhatun / switch-jquery-events Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bitmakerlabs/switch-jquery-events

0.0 0.0 0.0 50 KB

Practicing jQuery Events

CSS 64.08% HTML 12.49% JavaScript 23.43%

switch-jquery-events's Introduction

The Switch

You Assignment

Given the HTML and CSS as provided, use jQuery to hear the click of the switch and meet the following criteria:

  • When someone hits the <button> inside of the .switch, remove the current state class (.on/.off), and apply the opposite class (.on/.off)
  • Swap the color of the body's background and text by adding or removing the dark/light class. For advanced learning, try to store the values as variables and swap them directly without the use of classes
  • Lastly, change the text in box to say "It's so bright in here!" when the switch is in the on position, and "Hey, who turned off the lights?" when it's off

Hints

Start with small steps:

  1. Start by changing the background-color and text color
  • See if you can store the values as variables for swapping (later)
  1. Change the status .text() from one message to the other
  2. Change the class of the .switch>button from .on to .off
  3. Check if the button click() will trigger a function (try a simple alert() to test this)
  4. Combine the above steps to solve the problem:
  • use an if statement to change the text
  • try the jquery toggleClass function to change the light and dark backgrounds
  • you should be able to click the switch many times and it should switch back and forth between light and dark modes

switch-jquery-events's People

Contributors

seanlerner avatar amenakhatun avatar devonoel avatar natalieblack avatar juneate 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.