Git Product home page Git Product logo

funwithjquery's Introduction

FunWithJQuery Events

  • Level: Beginner
  • Description: Practice implementing jQuery DOM manipulations and event handlers

Lesson

Basic jQuery syntax: $(selector).action

To implement DOM manipulations and event handlers on HTML elements using jQuery, use the process flow:

  1. Identify the element you are watching/targetting (query/select the element)
  2. Indicate the action to be taken on the element and if applicable, refer to the function that should be invoked
  3. Write a function with all of the things that should happen when the action is triggered

Refer to the jQuery documentation for the full list of actions:

Challenges

  • Challenge Zero: On hover of each icon, change to giphy. When hovering off, return to icon
  • Challenge One: Change the title from “Fortnite Emotes!” to anything you want
  • Challenge Two: Remove the element with id “extra-text”
  • Challenge Three: On click of the Fortnite logo, change the bg to “bg2.jpg”
  • Challenge Four: On click of the emote titles, hide/show (toggle) the emote-info

Example

$(#icon”).hover(enter, leave); 

function enter() {
  this.src = “giphy.gif”;
} 

function leave() {
  this.src = “icon.gif”;
}

Relevant jQuery actions

  • Inner HTML → $(selector).html(“new text”)
  • Remove → $(selector).remove(“#element”)
  • Click →
$(selector).click(toBeExecuted)
  function toBeExecuted() {
      //all the things to be executed
  }
  • Toggle → $(selector).slideToggle()

Solution Gist

script.js

funwithjquery's People

Contributors

isabellatea avatar

Watchers

James Cloos 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.