Code Monkey home page Code Monkey logo

ph1-periodic-table-practice's Introduction

Practice Challenge - Periodic Table of Elements

Your task today is to complete a digital periodic table of elements. Some code has already been constructed however the table itself is blank and needs to be filled in with data. This will test your ability to use DOM manipulation (there is only one fetch request).

Getting Started

Fork and clone the repository. Take some time to look through and understand the code that's already been written. Once you're ready, start a new server with json-server --watch db.json and open the index.html file with your favorite browser.

Display All Elements

First, fetch the data from db.json which should return an array of objects. For each of these objects, you should:

  • Creates a new div with a class of atomic-element-card. This card displays the element's id number (technically it's atomic number) and its symbol in a pair of p tags nested inside the div. This div gets appended to the atomic-elements-container.

  • Example of the above:

<div class="atomic-element-card">
  <p>1</p>
  <p>H</p>
</div>

Hover Over Element

When someone hovers their mouse over an atomic-element-card, it shows all the details for that element in the div#atomic-element-details. For electrons per shell it's alright to change the array to a string and just display that (don't overthink it).

BONUS - Sort Elements

When the element cards are created, find a way to sort the elements before you add them to the the DOM so that they're in order of their atomic number (id).

SUPER BONUS - Filter Elements By Type

When someone selects a category in the #category-select dropdown, all elements that aren't part of the category are hidden and only elements of the category are shown (so for example if alkali-metals is selected then only elements that are alkali-metals get shown).

If all is selected, show all the elements.

HINT: To make this work, you can change a card's style to display: none rather than deleting the card itself! There are also other ways to do this.

ph1-periodic-table-practice's People

Contributors

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