Coder Social home page Coder Social logo

wunderkind's Introduction

A Wild Challenge (from Wunderkind) Appears!

Prompt

At Wunderkind, we often execute complex problems using entirely front-end JavaScript. For this challenge your solution should work if it is pasted directly into the JavaScript console of the browser after the page has fully loaded. Feel free to use jQuery. Also, our WKND products must work across all browsers, but we will be testing your challenge in Chrome.

Instructions

  • Go to kohls.com and add at least 2 products to your cart. Then return to the home page.
  • Write a JavaScript snippet that can be run in the console of the browser that does the following:
    • Extracts the number of items in the cart, the cart total, and the item images from the page. Store them in variables.
    • Creates a trigger that activates when the user scrolls into the bottom 10% of the page.
    • The trigger should show a centered overlay on top of the site that displays the information gathered above and two buttons:
      • one button should close the overlay
      • the other should take the user to the cart page
    • Behind the overlay add a semi­-transparent black background that obscures the site.
    • The overlay should be able to trigger multiple times if dismissed.
  • The overlay should have a style consistent with the website. Design matters.

Resources Used

  • jQuery - instead of using Vanilla JS to manipulate the DOM
  • Kohls - main website used to practice

Bugs I encountered

  • Images were undefined unless the cart was first clicked on the homepage
    • Added a click event within script to combat this problem
  • No cart items -> returns undefined
    • Conditionally render 0 items in cart, $0.00 total in the modal
  • Having additional items that did not fit in the modal
    • Used CSS overflow-y for better UI experience

Lessons I learned

  • I guess jQuery is not so bad
  • Spent a lot of time trying to get Bootstrap to work with jQuery, but was not successful in that endeavor
  • SOLID principles to break up code utility

Example image of completed modal

Wunderkind Modal

wunderkind's People

Contributors

victorhedev avatar

Stargazers

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