HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<div class="store-background"></div>
<main class="shopping-app">
<div id="iphone-info">
<div id="time">0:00</div>
<ul id="icons">
<li><i class="fas fa-signal"></i></li>
<li><i class="fas fa-wifi"></i></li>
<li><i class="fas fa-battery-three-quarters"></i></li>
</ul>
<i class="read-me-button fa fa-ellipsis-v"></i>
</div>
<section class="screen list-page active">
<aside class="app-module">
<div class="app-module-content">
<h1 class="module-header"></h1>
<div class="module-content"></div>
</div>
</aside>
<div class="screen-content">
<div class="user-info">
<div id="go-to-cart" class="shopping-cart">
<i class="cart-icon fa fa-shopping-cart"></i>
<p class="shopping-cart-count">0</p>
</div>
</div>
<img class="logo" alt="logo" src="https://pngimage.net/wp-content/uploads/2018/06/store-logo-png-1.png" />
<div class="add-item-container">
<i class="fa fa-shopping-bag"></i>
<input id="add-item-input" type="text" placeholder="Add to list" />
<button class="button add-item-button"><i class="fa fa-plus"></i></button>
</div>
<nav class="app-nav">
<ul class="app-nav-container">
<li id="shopping-list-button" class="app-nav-item active"><i class="fa fa-list-ol"></i>Shopping List</li>
<li id="search-store-button" class="app-nav-item"><i class="fa fa-store"></i>Search Store</li>
<li id="shopping-cart-button" class="app-nav-item"><i class="fa fa-shopping-cart"></i>View Cart</li>
</ul>
</nav>
<section id="pages" class="page-one">
<!-- Shopping List Screen Content -->
<div id="shopping-list-screen">
<ul id="shopping-list" class="list-section active">
<li class="list-item hot" draggable="true">coffee beans
<span class="price">$16.25</span>
</li>
<li class="list-item hot" draggable="true">chicken breast<span class="price">$16.25</span></li>
<li class="list-item hot" draggable="true">bike gloves<span class="price">$16.25</span></li>
<li class="list-item hot" draggable="true">rooibos tea<span class="price">$16.25</span></li>
<li class="list-item hot" draggable="true">new computer<span class="price">$16.25</span></li>
<li class="list-item hot" draggable="true">Nintendo Switch + BOTW<span class="price">$16.25</span></li>
</ul>
<!-- <div class="error-message">No items found in your list. Add some above.</div> -->
<div class="button-container">
<button class="button empty-cart-button">
Empty cart
</button>
<div class="button-divider"></div>
<button class="button delete-all-button">
Delete list
</button>
<div class="button-divider"></div>
<button class="button reset-list-button">
Reset all
</button>
</div>
</div>
<!-- Search Store Screen Content -->
<div id="store-search" class="list-section">
<div class="store-filter-container">
<p class="search-results">
<!-- <span class="search-query-quantity"></span> results for: <span class="search-query-result"></span> -->
</p>
<div class="store-filter-tools">
<select class="price-filter">
<option value="rel">Relevance</option>
<option value="low">Lowest price</option>
<option value="high">Highest price</option>
</select>
<i class="fa fa-th store-view"></i>
</div>
</div>
<ul id="store-items" class="store-items grid">
<!-- Coffee -->
<li class="store-list-item" data-item-type="coffee" data-item-price="9.99">
<div class="store-list-item-img-container">
<img src="https://images-na.ssl-images-amazon.com/images/I/81P2cJ8QrIL._AC_UL320_SR172,320_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">Wicked Joe Bella Maria coffee beans, 12 oz.</p>
<p class="store-list-item-price">$9.99</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="coffee" data-item-price="10.59">
<div class="store-list-item-img-container">
<img src="https://www.vitacost.com/Images/Products/500/Wicked-Joe/Wicked-Joe-Organic-Ground-Coffee-Dark-Roast-Wicked-Italian-873562001866.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">Wicked Joe Wicked Italian coffee beans, 12 oz.</p>
<p class="store-list-item-price">$10.59</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item selected" data-item-type="coffee" data-item-price="8.99">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/81A1wMoersL._AC_UL320_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">Wicked Joe Big House coffee beans, 12 oz.</p>
<p class="store-list-item-price">$8.99</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="coffee" data-item-price="9.79">
<div class="store-list-item-img-container">
<img src="https://ship.kroger.com/img/Products/500/Wicked-Joe/Wicked-Joe-Organic-Ground-Coffee-Medium-Roast-Sumatra-873562000906.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">Wicked Joe Sumatra coffee beans, 12 oz.</p>
<p class="store-list-item-price">$9.79</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="coffee" data-item-price="10.29">
<div class="store-list-item-img-container">
<img src="https://images-na.ssl-images-amazon.com/images/I/81Cp9-9O4cL._AC_UL320_SR172,320_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">Wicked Joe Wicked French coffee beans, 12 oz.</p>
<p class="store-list-item-price">$10.29</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="coffee" data-item-price="10.29">
<div class="store-list-item-img-container">
<img src="https://ship.kroger.com/img/Products/500/Wicked-Joe/Wicked-Joe-Organic-Decaf-Ground-Coffee-Dark-Roast-Wicked-French-873562000913.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">Wicked Joe Wicked French Decaf coffee beans, 12 oz.</p>
<p class="store-list-item-price">$10.29</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<!-- Protein -->
<li class="store-list-item" data-item-type="protein" data-item-price="40.99">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/71K5dv0r50L._AC_UL320_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">Musclepharm Combat Chocolate Protein Powder, 64 oz</p>
<p class="store-list-item-price">$40.99</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="protein" data-item-price="89.00">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/71MP6StSJiL._AC_UL320_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">Beyond Raw ISO-Peptide Anabolic Protein Powder, 30 servings</p>
<p class="store-list-item-price">$89.00</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="protein" data-item-price="29.99">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/71C+RqPviNL._AC_UL320_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">100% Whey Protein, 2 lb.</p>
<p class="store-list-item-price">$29.99</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="protein" data-item-price="42.89">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/71pTf0qr-HL._AC_UL320_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">Optimum Nutrition 100% Whey Gold Standard, 2 lb.</p>
<p class="store-list-item-price">$42.89</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="protein" data-item-price="59.99">
<div class="store-list-item-img-container">
<img src="https://images-na.ssl-images-amazon.com/images/I/91ruQZ2T3jL._SX522_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">Nutrabio Classic Whey Protein Powder, 5 lb.</p>
<p class="store-list-item-price">$59.99</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="protein" data-item-price="89.00">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/51w9jfT4AxL._AC_UL320_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">Royal Whey Protein Isolate, 5 lb.</p>
<p class="store-list-item-price">$89.00</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<!-- Chicken -->
<li class="store-list-item" data-item-type="chicken" data-item-price="24.99">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/81W5RmJiQPL._AC_UL320_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">Omaha Steaks 8 Boneless Chicken Breasts, 2 lb. pkg.</p>
<p class="store-list-item-price">$24.99</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="chicken" data-item-price="86.78">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/41bUWP1d3IL._AC_UL320_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">Tyson Red Label, Fully Cooked Grilled Chicken Breast, 40 pieces</p>
<p class="store-list-item-price">$86.78</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="chicken" data-item-price="19.99">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/81tqUd4VXUL._AC_UL320_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">Omaha Steaks 8 Italian Chicken Breasts, 3 oz. ea.</p>
<p class="store-list-item-price">$19.99</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="chicken" data-item-price="99.00">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/31ZDIFly3DL._AC_UL320_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">Today Gourmet - Lemon Herb Chicken, 18 @ 5 oz.</p>
<p class="store-list-item-price">$99.00</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="chicken" data-item-price="68.02">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/41UGTuou7rL._AC_UL320_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">Tyson Red Label Golden Crispy Breaded Chicken Breast Patty, 5 lb.</p>
<p class="store-list-item-price">$68.02</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="chicken" data-item-price="14.99">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/81vqw-oa7zL._AC_UL320_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">Omaha Steaks 4 Chicken Fried Chicken, 4.5 oz.</p>
<p class="store-list-item-price">$14.99</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<!-- Tea -->
<li class="store-list-item" data-item-type="tea" data-item-price="10.99">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/519mpZhG+TL._AC_UL320_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">Twinings of London English Breakfast Black Tea Bags, 100 count</p>
<p class="store-list-item-price">$10.99</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="tea" data-item-price="22.80">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/51XcYsV4RYL._AC_UL320_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">Twinings of London Blackcurrant Breeze Black Tea Bags, 20 count</p>
<p class="store-list-item-price">$22.80</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="tea" data-item-price="25.60">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/51Tkm7jQK8L._AC_UL320_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">Twinings of London Lady Grey Black Tea Bags, 20 count</p>
<p class="store-list-item-price">$25.60</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="tea" data-item-price="36.06">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/511NRVx8PoL._AC_UL320_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">Twinings of London Irish Breakfast Black Tea Bags, 50 count</p>
<p class="store-list-item-price">$36.06</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="tea" data-item-price="17.64">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/51EpUQ+Jj1L._AC_UL320_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">Twinings of London Camomile, Honey & Vanilla Herbal Tea, 20 count</p>
<p class="store-list-item-price">$17.64</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="tea" data-item-price="20.85">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/51wHht0TFUL._AC_UL320_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">Twinings of London Pure Rooibos Herbal Red Tea Bags, 20 count</p>
<p class="store-list-item-price">$20.85</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<!-- Legos -->
<li class="store-list-item" data-item-type="lego" data-item-price="36.74">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/91dKfDlGK2L._AC_UL320_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">LEGO Ninjago Movie Green Ninja Mech Dragon 70612, 544 pieces</p>
<p class="store-list-item-price">$36.74</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="lego" data-item-price="69.00">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/71fmrWjDLUL._AC_UL320_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">LEGO Ninjago Movie Fire Mech 70615, 944 pieces</p>
<p class="store-list-item-price">$69.00</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="lego" data-item-price="81.49">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/91-2LpXYsPL._AC_UL320_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">LEGO Ninjago Movie Quake Mech 70632, 1202 pieces</p>
<p class="store-list-item-price">$81.49</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="lego" data-item-price="68.31">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/71tAyit2bVL._AC_UL320_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">LEGO Ninjago Movie, Garma Mecha Man 70613, 747 pieces</p>
<p class="store-list-item-price">$68.31</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="lego" data-item-price="107.99">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/61NhzsM22GL._AC_UL320_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">LEGO Ninjago Movie Temple Ultimate Ultimate Weapon 70617, 1403 pieces</p>
<p class="store-list-item-price">$107.99</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="lego" data-item-price="229.95">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/71Zglj2BdyL._AC_UL320_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">LEGO Ninjago Movie Destiny's Bounty, 2295 pieces</p>
<p class="store-list-item-price">$229.95</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<!-- Other -->
<li class="store-list-item" data-item-type="bike" data-item-price="14.99">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/61044OTtt9L._AC_UY218_QL90_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">Fox Racing Ranger Mountain Bike Gloves</p>
<p class="store-list-item-price">$14.99</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="bike">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/71QEzBQ3hGL._AC_UY218_QL90_.jpg" />
</div>
<div class="store-list-item-meta" data-item-price="54.95">
<p class="store-list-item-title">Giro Fixture Bike Helmet with MIPS</p>
<p class="store-list-item-price">$54.95</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="bike" data-item-price="1499.00">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/71nfqEsAp1L._AC_UL320_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">Carbon Road Bike, SAVA HERD 6.0 T800 Carbon Fiber 700C Road Bicycle</p>
<p class="store-list-item-price">$1,499.00</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="game" data-item-price="405.00">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/711uJA2i+JL._AC_UY218_QL90_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">Nintendo Switch Console w/ Mario Kart 8 Deluxe</p>
<p class="store-list-item-price">$405.00</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="game" data-item-price="199.96">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/71qmF0FHj7L._AC_UY218_QL90_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">Nintendo Switch Lite - Turquoise</p>
<p class="store-list-item-price">$199.96</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
<li class="store-list-item" data-item-type="game" data-item-price="49.94">
<div class="store-list-item-img-container">
<img src="https://m.media-amazon.com/images/I/511M6ML2t7L._AC_UY218_QL90_.jpg" />
</div>
<div class="store-list-item-meta">
<p class="store-list-item-title">The Legend of Zelda: Breath of the Wild - Nintendo Switch</p>
<p class="store-list-item-price">$49.94</p>
<a class="button store-list-item-to-cart">Add to Cart</a>
</div>
</li>
</ul>
<!-- <div class="error-message">No items found for your search query. Please try again.</div> -->
</div>
<!-- View Cart Screen Content -->
<div id="view-cart" class="list-section">
<ul class="cart-progress-container">
<li class="cart-progress-indicator active">Review</li>
<li class="cart-progress-indicator">Payment</li>
<li class="cart-progress-indicator">Complete</li>
</ul>
<ul id="cart-items" class="store-items list">
<!-- To be built while shopping -->
</ul>
<!-- <div class="error-message">No items found in your cart. Let's go shopping!</div> -->
<div class="button-container payment-container">
<p class="subtotal">Total: <strong>$<span id="cartTotalPrice">0.00</span></strong></p>
<button class="checkout-button">Checkout (0)</button>
</div>
</div>
</section>
</div>
</section>
<section class="screen info-page active">
<div class="screen-content">
<img class="logo" alt="logo" src="https://pngimage.net/wp-content/uploads/2018/06/store-logo-png-1.png" />
<div class="info-page-content">
<h1>JS Conf Korea 2019 <span><a href="https://2019.jsconfkorea.com/en/tutorials/" target="_blank">(Sept. 3, 2019)</a></span></h1>
<h2>Learn JavaScript by Building a Shopping App in CodePen</h2>
<p>Learn by doing! The best way to learn JavaScript is with projects, so we'll be building a shopping app in CodePen.</p>
<p>In this tutorial, we'll learn how JavaScript can manipulate data and the DOM to create a multi-screen, dynamic web app, right inside CodePen. We will walk through the app-building process together: from creating app screens in HTML & CSS, to adding
basic JavaScript functionality with button presses, to adding basic data processing. This tutorial is aimed at beginner developers.</p>
<h2>About <a href="https://aaron.kr" target="_blank">Aaron Snowberger</a></h2>
<p>Aaron is a frontend designer/developer who likes to dabble in backend and mobile technologies. His current passions include React, React Native, Node, and the WP REST API. He’s also a Google Certified Trainer who has taught computer science and
graphic design in high school since 2013. He's passionate about helping new learners discover the joys of JavaScript.</p>
<small><span>Note:</span> Items listed in the Store screen are primarily referenced from <a href="https://amazon.com" target="_blank">Amazon.com</a>, but there are no affiliate links.</small>
</div>
</div>
</section>
<p class="toast">Some event happened!</p>
</main>
/**
* CSS Structure
* 0. General app styles
* 1. List screen
* 2. Search screen
* 3. Cart screen
* 4. Checkout screen
*/
/*---------------------------------------
* General app styles : SCREEN_SIZE (width: 375px, 812px)
*---------------------------------------*/
* {
/* position: relative; */
box-sizing: border-box;
}
body {
background: #232323;
color: white;
font-family: 'Open Sans', sans-serif;
overflow: hidden;
box-sizing: border-box;
position: relative;
overflow-y: scroll;
}
img {
display: block;
}
.store-background {
background-image: url('https://images.pexels.com/photos/1831825/pexels-photo-1831825.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260');
background-position: center;
background-size: cover;
-webkit-filter: blur(5px);
-moz-filter: blur(5px);
-o-filter: blur(5px);
-ms-filter: blur(5px);
filter: blur(5px);
width: 100vw;
height: 130%;
position: absolute;
top: -2rem;
}
#iphone-info {
position: absolute;
display: flex;
justify-content: space-between;
width: 100%;
height: 30px;
/* background: #111; */
z-index: 10;
top: 0;
border-radius: 20px 20px 0 0;
}
#iphone-info:before {
content: '';
height: 10px;
width: 60px;
z-index: 10;
background: #333;
display: block;
border-radius: 15px;
top: 10px;
position: absolute;
left: 50%;
transform: translateX(-50%);
}
#iphone-info:after {
position: absolute;
/* Permalink - use to edit and share this gradient: https://colorzilla.com/gradient-editor/#959595+0,0d0d0d+46,010101+50,0a0a0a+53,4e4e4e+76,383838+87,1b1b1b+100;Black+Gloss+Pipe */
background: #959595; /* Old browsers */
background: -moz-linear-gradient(-45deg, #959595 0%, #0d0d0d 46%, #010101 50%, #0a0a0a 53%, #4e4e4e 76%, #383838 87%, #1b1b1b 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(-45deg, #959595 0%,#0d0d0d 46%,#010101 50%,#0a0a0a 53%,#4e4e4e 76%,#383838 87%,#1b1b1b 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(135deg, #959595 0%,#0d0d0d 46%,#010101 50%,#0a0a0a 53%,#4e4e4e 76%,#383838 87%,#1b1b1b 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#959595', endColorstr='#1b1b1b',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
content: '';
display: block;
height: 16px;
width: 16px;
border-radius: 12px;
z-index: 10;
top: 7px;
left: 50%;
transform: translateX(40px);
}
#time {
margin: 10px 20px;
font-size: 0.9rem;
}
#icons {
margin: 7px 10px;
}
#icons li {
list-style: none;
display: inline-block;
font-size: 0.7rem;
margin-left: 5px;
}
.shopping-app {
/* iPhone resolutions: https://www.paintcodeapp.com/news/ultimate-guide-to-iphone-resolutions */
background: #232323;
position: relative;
width: 391px; /* border is 8px each side, 16px total */
height: 828px; /* actual size 812px, but consider border as well */
margin: 1rem auto;
padding-top: 1.5rem;
border: 8px solid black;
border-radius: 30px;
box-shadow: 0px 9px 40px rgba(0,0,0,0.9);
}
.shopping-app:before {
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
height: 30px;
width: 209px;
background: black;
border-radius: 0 0 20px 20px;
content: '';
z-index: 10;
}
.shopping-app:after {
position: absolute;
bottom: 10px;
left: 50%;
transform: translateX(-50%);
background: black;
content: '';
height: 10px;
width: 112px;
border-radius: 20px;
z-index: 10;
}
.screen {
display: none;
background: #232323;
width: 375px;
height: 812px;
position: relative;
overflow: hidden;
top: -24px;
border-radius: 25px;
z-index: 0;
}
/* Module */
.app-module {
transition: all 0.3s;
display: none;
position: absolute;
z-index: 998;
background: rgba(0,0,0,0.76);
top: 0;
right: 0;
bottom: 0;
left: 0;
height: 100%;
width: 100%;
}
.app-module-content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 999;
background: white;
color: #232323;
width: 95%;
padding: 1rem;
box-sizing: border-box;
border-radius: 20px;
box-shadow: 2px 4px 8px rgba(0,0,0,0.54);
}
.screen-content {
position: relative;
top: 50px;
height: 762px; /* 812px - 40px */
overflow: hidden;
}
.screen.active {
display: block;
}
.info-page {
position: absolute;
top: 0px;
margin-top: 0px;
background: mediumaquamarine;
z-index: 1;
transition: all 0.5s;
width: 0;
opacity: 0;
}
.info-page .screen-content {
top: 40px;
}
.info-page.expanded {
width: 375px;
opacity: 1;
}
.info-page-content {
padding: 1rem;
font-size: 80%;
}
.info-page-content h1 {
font-family: 'Open Sans Condensed', sans-serif;
color: #e57248;
color: #365;
font-weight: bold;
font-size: 1.4rem;
}
.info-page-content h1 span {
font-size: 80%;
}
.info-page-content h1 a,
.info-page-content h2 a {
color: #264c3f;
}
.info-page-content h2 {
font-size: 1rem;
color: #365;
}
.info-page-content small {
font-style: italic;
color: #4c997f;
display: block;
margin-top: 2rem;
}
.info-page-content small a {
color: #365;
}
.logo {
max-width: 50%;
margin: 1rem auto;
display: block;
filter: invert(100%);
}
.logo:hover {
filter: invert(80%);
}
.app-title {
font-family: 'Open Sans Condensed', Impact;
font-size: 18px;
text-transform: uppercase;
letter-spacing: 3px;
margin: 1rem 0;
text-align: center;
}
.read-me-button {
position: absolute;
top: 50px;
left: 15px;
font-size: 1.2rem;
opacity: 0.5;
cursor: pointer;
z-index: 997;
}
.read-me-button:hover {
opacity: 0.9;
}
.app-nav {
border-top: 1px solid black;
border-bottom: 1px solid black;
padding: 1rem;
}
.app-nav-container {
padding: 0;
margin: 0;
list-style: none;
display: flex;
/* flex-direction: 'row'; */
align-items: center;
justify-content: space-around;
width: 100%;
}
.app-nav-item {
/* display: inline-block; */
font-size: 13px;
opacity: 0.7;
cursor: pointer;
}
.app-nav-item .fa {
opacity: 0.5;
margin-right: 5px;
}
.app-nav-item:hover,
.app-nav-item:hover .fa {
opacity: 0.9;
}
.app-nav-item.active {
color: lightcoral;
}
#pages {
display: grid;
grid-template-columns: 375px 375px 375px;
transition: all 0.5s;
}
#pages.page-one {
transform: translateX(0px);
}
#pages.page-two {
transform: translateX(-375px);
}
#pages.page-three {
transform: translateX(-750px);
}
.list-section {
margin: 0;
padding: 0;
width: 375px;
height: 490px;
/* overflow-y: scroll; */
transition: all 0.5s;
}
.list-item {
transition: 1s all;
position: relative;
right: 0;
height: 35px;
opacity: 1;
box-sizing: border-box;
display: block;
font-family: 'Open Sans', Arial, sans-serif;
list-style: none;
font-size: 12px;
background: coral;
padding: 0.5rem 1rem;
border-top: 1px solid rgba(255,255,255,0.3);
border-bottom: 1px solid rgba(0,0,0,0.1);
}
.list-item:hover {
opacity: 0.8;
cursor: pointer;
}
.list-item .price {
float: right;
margin-right: 30px;
opacity: 0.5;
visibility: hidden;
}
/*---------------------------------------
* List screen
*---------------------------------------*/
.new {
height: 0;
margin: 0;
padding: 0;
opacity: 0;
}
.button {
margin: 1rem auto;
display: block;
font-family: 'Open Sans Condensed', sans-serif;
text-transform: uppercase;
color: white;
font-size: 14px;
background: transparent;
border: 1px solid rgba(255,255,255,0.2);
border-radius: 30px;
padding: 5px 15px;
font-weight: bold;
letter-spacing: 2px;
}
.button:hover {
color: coral;
cursor: pointer;
border-color: rgba(255,127,80, 0.2);
}
.button:active,
.button:focus {
outline: none;
/* border: none; */
border-color: rgba(255,127,80, 0.2);
}
.button-divider {
/* border-right: 1px solid rgba(255,255,255,0.2); */
/* height: 140px; */
/* margin-top: 10px; */
/* border-left: 1px solid rgba(255,255,255,0.6); */
}
.button-container {
background: #232323;
display: flex;
margin-top: 1rem;
padding-bottom: 1rem;
border-top: 1px solid rgba(0,0,0,1);
bottom: 0px;
width: 100%;
position: absolute;
z-index: 2;
}
.add-item-container {
height: 30px;
margin: 0 20px 1rem;
background: white;
border-radius: 20px;
padding: 0 10px;
}
.add-item-container input {
box-sizing: border-box;
height: 30px;
border: none;
width: calc( 100% - 50px);
font-family: 'Open Sans';
padding-left: 10px;
}
.add-item-container input:focus,
.add-item-container input:active {
outline: none;
}
.add-item-container.disabled,
.add-item-container input:disabled {
background: #ccc;
cursor: not-allowed;
}
.add-item-container .fa-shopping-bag {
color: coral;
opacity: 0.5;
background: transparent;
}
.add-item-button {
display: inline-block;
background: mediumaquamarine;
margin: 0;
position: absolute;
width: 42px;
height: 30px;
border-radius: 0 20px 20px 0;
cursor: pointer;
}
.add-item-button.disabled {
cursor: not-allowed;
background: #4c997f;
opacity: 0.7;
}
.add-item-button.disabled:hover {
color: white;
}
.purchased {
background: mediumaquamarine;
text-decoration: line-through;
}
.delete-button {
text-decoration: none;
text-transform: uppercase;
background: transparent;
position: absolute;
right: 10px;
border: 0;
color: white;
}
.delete {
/* transition: 1s all;
position: absolute; */
right: -375px;
opacity: 0;
/* display: none; */
}
.add {
left: -375px;
opacity: 0;
}
/* Shopping Cart info */
.user-info {
/* background: blue; */
width: 100%;
}
.shopping-cart {
margin-top: 15px;
margin-right: 10px;
position: absolute;
right: 0;
cursor: pointer;
}
.cart-icon {
box-sizing: border-box;
opacity: 0.5;
font-size: 1.2rem;
padding: 7px 0;
border: 1px solid white;
width: 36px;
height: 36px;
border-radius: 20px;
text-align: center;
}
.cart-icon:hover {
opacity: 0.8;
}
.shopping-cart-count {
position: absolute;
top: 17px;
left: -10px;
font-size: 9px;
background: coral;
width: 20px;
text-align: center;
border-radius: 5px;
/* display: none; */
}
.pseudo-item {
transition: 1s all;
position: absolute;
top: 15px;
right: 0;
transform: translateY(-50%);
z-index: -1;
width: 375px;
height: 35px;
background: mediumaquamarine;
}
.to-cart {
/* position: fixed;
top: 43px;
left: calc( 50% + 134px ); */
right: 10px;
top: -176px;
/* transform: translate(0, -200px); */
width: 36px;
height: 36px;
border-radius: 36px;
}
.toast {
transition: 0.5s all;
box-sizing: border-box;
position: absolute;
bottom: -180px;
opacity: 0;
left: 50%;
transform: translateX(-50%);
background: rgba(189, 183, 107, 0.8);
padding: 1.2rem;
text-align: center;
border-radius: 20px;
width: 80%;
font-size: 14px;
box-shadow: 2px 10px 10px rgba(0,0,0,0.2);
}
.show-toast {
opacity: 1;
bottom: -80px;
box-shadow: 2px 10px 40px rgba(0,0,0,1);
}
.jiggle {
animation: jiggle 2s ease-in;
}
@keyframes jiggle {
0%, 10% {
transform: scale(1.0, 1.0)
}
3% {
transform: scale(1.1, 0.9)
}
6% {
transform: scale(0.9, 1.1) translate(0, -5px)
}
9% {
transform: scale(1.0, 1.0) translate(0, -3px)
}
}
/*---------------------------------------
* 2. Search screen
*---------------------------------------*/
#store-search.list-section {
background: green;
height: 570px;
overflow-y: hidden;
position: relative;
margin: 0;
padding: 0;
}
.store-filter-container {
color: #232323;
background: white;
cursor: pointer;
display: flex;
width: 100%;
justify-content: space-between;
align-items: center;
height: 30px;
border-bottom: 1px solid rgba(0,0,0,0.24);
}
#store-search select {
border-radius: 20px;
color: #454545;
background: #efefef;
height: 20px;
margin-right: 1rem;
}
.store-filter-container .fa {
opacity: 0.5;
margin-right: 1rem;
/* position: absolute;
right: 1rem;
top: 0.5rem; */
}
.store-items {
background: white;
overflow-y: scroll;
color: #232323;
font-size: 80%;
list-style: none;
padding: 0 0 30px 0;
margin: 0px 0 0px 0;
display: grid;
/* border-top: 1px solid rgba(0,0,0,0.24); */
border-bottom: 1px solid rgba(0,0,0,0.1);
height: 540px;
}
.store-list-item {
padding: 1rem;
background: white;
/* border-top: 1px solid rgba(0,0,0,0.1); */
border-bottom: 1px solid rgba(0,0,0,0.14);
cursor: pointer;
position: relative;
transition: all 0.3s;
}
.pseudo-store-item {
background: mediumaquamarine;
position: absolute;
top: 0;
right: 0;
left: 0;
bottom: 0;
z-index: 100;
opacity: 0;
transition: all 0.3s;
}
.pseudo-store-item.selected {
opacity: 0.5;
}
/* .error-message {
position: absolute;
top: 2rem;
color: black;
font-size: 80%;
text-align: center;
width: 100%;
margin: 1rem;
box-sizing: border-box;
z-index: 0;
} */
.store-list-item:last-child {
margin-bottom: 40px;
border-bottom: none;
}
.store-list-item-img-container {
text-align: center;
margin-right: 1rem;
}
.store-list-item img {
max-height: 100px;
max-width: 100%;
display: block;
margin: 0 auto;
}
.store-list-item .button {
color: coral;
font-size: 0.6rem;
padding: 0;
border: 0;
margin: 0;
}
.store-items.list {
grid-template-columns: 1fr;
align-content: start;
}
.store-items.list .store-list-item {
display: grid;
grid-template-columns: 1fr 3fr;
max-height: 140px;
align-self: start;
}
.store-items.grid {
grid-template-columns: 1fr 1fr 1fr;
}
.search-results {
font-size: 80%;
margin-left: 1rem;
}
.search-query-quantity {
font-weight: bold;
}
.reset-search {
padding: 0;
margin: 0 0 0 0.5rem;
display: inline;
color: coral;
cursor: pointer;
}
.reset-search:hover {
color: lightsalmon;
}
/*---------------------------------------
* 3. Cart screen
*---------------------------------------*/
#cart-items.store-items {
height: 470px;
padding-bottom: 10px;
}
#cart-items .store-list-item:last-child {
margin-bottom: 10px;
}
.cart-progress-container {
background: lightsalmon;
color: rgba(255,255,255,0.7);
margin: 0 0 0 -2.5rem;
font-size: 80%;
list-style: none;
border-bottom: 1px solid rgba(0,0,0,0.24);
display: grid;
grid-template-columns: 1fr 1fr 1fr;
}
.cart-progress-indicator {
display: inline-block;
text-align: center;
margin: 0;
height: 30px;
padding: 5px 0 0 0;
position: relative;
}
.cart-progress-indicator:before,
.cart-progress-indicator:after {
content: '';
display: block;
border-left: 10px solid coral;
border-top: 15px solid transparent;
border-bottom: 15px solid transparent;
position: absolute;
top: 0;
right: -10px;
width: 0px;
height: 0px;
z-index: 1;
}
.cart-progress-indicator:before {
border-left-color: lightsalmon;
right: -8px;
z-index: 2;
}
.cart-progress-indicator.active {
background: coral;
color: rgba(255,255,255,0.8);
}
.cart-progress-indicator.active:before {
border-left-color: coral;
}
.payment-container {
display: flex;
justify-content: space-between;
color: #232323;
background: white;
height: 70px;
}
.subtotal {
margin-left: 1rem;
padding-top: 5px;
font-size: 80%;
}
.checkout-button {
border: none;
background: mediumaquamarine;
color: white;
font-family: 'Open Sans Condensed', sans-serif;
text-transform: uppercase;
letter-spacing: 2px;
font-size: 1.2rem;
min-width: 60%;
}
/*---------------------------------------
* 4. Checkout screen
*---------------------------------------*/
/* --------------------------------------------
* App Setup
* -------------------------------------------- */
// Declare empty arrays to contain our DOM Nodes
let ORIGINAL_STORE_ITEMS = [];
let CURRENT_STORE_ITEMS = [];
let CART_ITEMS = [];
// Setup the store with what we've already built in HTML
buildStore();
/* --------------------------------------------
* Build the Store
* -------------------------------------------- */
function buildStore() {
var items = document.querySelectorAll('.store-list-item');
for( var i = 0; i < items.length; i++ ) {
// Add all items into our array that we never intend to modify -
// This should always contain the original store items
// so that we can always restore the original store
ORIGINAL_STORE_ITEMS.push(items[i]);
// Add some visual feedback when store items are clicked
items[i].onmousedown = function(e) {
highlightItem(e.currentTarget);
}
items[i].onmouseup = function(e) {
highlightRemove(e.currentTarget);
}
}
}
/* --------------------------------------------
* Change Store list view (grid / list)
* -------------------------------------------- */
document.querySelector('.store-view').onclick = function() {
if( document.getElementById('store-items').className === 'store-items list' ) {
document.getElementById('store-items').className = 'store-items grid';
} else {
document.getElementById('store-items').className = 'store-items list';
}
};
/* --------------------------------------------
* Filter Store
* -------------------------------------------- */
// Add Event listener to Filter <select>
document.querySelector('.price-filter').addEventListener('change', function(e) {
console.log('changed! ' + e.target.value);
let newStore = filterStore(e.target.value);
console.log('New Store:', newStore);
redrawStore( newStore );
});
// Filter Store function
function filterStore( val ) {
let originalStore = ORIGINAL_STORE_ITEMS;
// remove all items from store
document.getElementById('store-items').innerHTML = '';
// sort store based on filter value
let filteredStore = CURRENT_STORE_ITEMS.length === 0
? ORIGINAL_STORE_ITEMS
: CURRENT_STORE_ITEMS;
filteredStore.sort( function ( item1, item2 ) {
let item1Price = parseFloat(item1.innerText.substring(
item1.innerText.indexOf('$') + 1,
item1.innerText.indexOf('Add')
).replace(/,/g, ''));
let item2Price = parseFloat(item2.innerText.substring(
item2.innerText.indexOf('$') + 1,
item2.innerText.indexOf('Add')
).replace(/,/g, ''));
if ( item1Price > item2Price ) {
return 1;
} else {
return -1;
}
});
console.log(filteredStore);
if ( val === 'low' ) {
console.log(filteredStore);
return filteredStore;
} else if ( val === 'high' ) {
console.log(filteredStore);
return filteredStore.reverse();
} else {
console.log(originalStore);
return originalStore;
}
}
/* --------------------------------------------
* Search Store
* -------------------------------------------- */
// Modify the original Add Button click function to now include Store Search
document.querySelector('.add-item-button').onclick = function() {
if ( APP_PAGES.className === 'page-two' ) {
storeSearch();
} else if ( APP_PAGES.className === 'page-one' ) {
addItem();
}
}
// Search Store function
function storeSearch() {
let query = STORE_INPUT.value.trim();
if ( query === '' ) return;
showToast('search', query);
STORE_INPUT.value = '';
// sort store based on filter value
let originalStore = ORIGINAL_STORE_ITEMS;
let newStore = [];
// If query is multi-worded (not implemented yet)
// let searchTerms = [];
// if ( query.indexOf(' ') !== -1 ) {
// searchTerms = query.split(' ');
// console.log(searchTerms);
// }
for( var i = 0; i < originalStore.length; i++ ) {
let item = originalStore[i].innerText.toLowerCase();
if( item.indexOf( query.toLowerCase() ) !== -1 || originalStore[i].dataset.itemType === query ) {
newStore.push(originalStore[i]);
}
}
// Set the found items to the current store items
CURRENT_STORE_ITEMS = newStore;
redrawStore( newStore );
// reset filter
document.querySelector('.price-filter').selectedIndex = 0;
// display query results
document.querySelector('.search-results').innerHTML = newStore.length + ' results for: ' + query;
// add reset search button
let reset = document.createElement('span');
reset.className = 'reset-search';
reset.innerHTML = '<i class="fa fa-times"></i>';
reset.onclick = function() {
redrawStore( ORIGINAL_STORE_ITEMS );
document.querySelector('.search-results').innerHTML = '';
}
document.querySelector('.search-results').appendChild(reset);
}
/* --------------------------------------------
* Redraw Store
* -------------------------------------------- */
/*
* 1. Accepts a "store" array as an argument
* 2. Erases all current store items and
* 3. Redraws store argument elements
*/
function redrawStore( store ) {
// remove all items from store
document.getElementById('store-items').innerHTML = '';
var newItem = null;
for( var i = 0; i < store.length; i++ ) {
newItem = document.createElement('li');
newItem.className = 'store-list-item';
newItem.innerHTML = store[i].innerHTML;
// Add some visual feedback when store items are clicked
newItem.onmousedown = function(e) {
highlightItem(e.currentTarget);
}
newItem.onmouseup = function(e) {
highlightRemove(e.currentTarget);
}
document.getElementById('store-items').appendChild(newItem);
}
}
/* --------------------------------------------
* Visual Feedback
* (highlight and add to cart when clicked)
* -------------------------------------------- */
function highlightItem( item ) {
var pseudoItem = document.createElement('span');
pseudoItem.className = 'pseudo-store-item selected';
item.appendChild(pseudoItem);
}
function highlightRemove( item ) {
item.lastChild.remove();
storeAddToCart(item);
}
/* --------------------------------------------
* Add Item to Cart
* -------------------------------------------- */
function storeAddToCart( item ) {
// Doctor up the item we're adding - making it specific for the cart
var tempItem = item.cloneNode(true);
CART_ITEMS.push(tempItem);
CART_COUNT.innerHTML = parseInt(CART_COUNT.innerHTML) + 1;
CART_COUNT.className = 'shopping-cart-count jiggle';
setTimeout( function() {
CART_COUNT.className = 'shopping-cart-count';
}, 500);
showToast('click-add');
// Add to Cart Screen
document.getElementById('cart-items').appendChild(tempItem);
}
Also see: Tab Triggers