Artist Card Widget
How do I make an artist card widget?
Inspiration from http://codepen.io/gabrielcolombo/details/VezPKL. What is a artist card widget? How do you make a artist card widget? This script and codes were developed by Devin on 23 November 2022, Wednesday.
Artist Card Widget - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Artist Card Widget</title> <link href='https://fonts.googleapis.com/css?family=Roboto:900,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <!-- :) -->
<!-- inspired from https://codepen.io/gabrielcolombo/pen/VezPKL/ -->
<!-- decided to add a little functionality to the concept and wanted to practice using jsx--> <script src='http://cdnjs.cloudflare.com/ajax/libs/react/0.14.3/react.min.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/react/0.14.3/react.min.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Artist Card Widget - Script Codes CSS Codes
body { padding: 50px;
}
#card { position: relative; margin-top: 50px; height: 650px; width: 500px; margin: 0 auto; /*from https://codepen.io/gabrielcolombo/pen/VezPKL/*/ box-shadow: 0 45px 100px rgba(0, 0, 0, 0.4); background-color: #9E90A2; /* --- */ background-image: url("https://i.ytimg.com/vi/4EisZRNaqzg/maxresdefault.jpg"); background-position: center;
}
html { background-color: #454553;
}
.placement_number { color: #E84A5F; font-family: "Roboto", sans-serif; font-weight: 900; font-size: 10em; margin-left: -150px; position: absolute; bottom: 0; animation-name: scrollRight; animation-duration: 2s; animation-fill-mode: forwards;
}
.artist_name { color: #d8e9f0; position: absolute; font-family: "Roboto", sans-serif; font-weight: 900; font-size: 100px; margin-left: 50px; bottom: 20px; z-index: 99; text-shadow: -5px -1px 5px rgba(0, 0, 0, 0.4); animation-name: scrollUp; animation-duration: 2s; animation-fill-mode: forwards;
}
.artist_genre { position: absolute; height: 40px; width: 400px; margin: 10px 0px 0px 50px; opacity: .3; text-align: center; background-color: none; padding-top: 20px; border: 2px solid white; border-radius: 20px; color: white; font-family: "Roboto", sans-serif; font-size: 20px; font-weight: 800; letter-spacing: 4px; animation-name: scrollDown; animation-duration: 2s; animation-fill-mode: forwards;
}
.right_button { position: absolute; right: 0px;
}
.right_button:hover { background-color: #2c5d63;
}
.left_button { position: absolute; left: 0px; display: none;
}
.left_button:hover { background-color: #2c5d63;
}
.right_button, .left_button { cursor: pointer; background-color: #444f5a; border: 0px;
}
.card_track { position: absolute; bottom: 0px; width: 500px; background-color: #1a2f4b; height: 0px; z-index: 1; opacity: 0;
}
.card_track .card_selection { display: inline-block; cursor: pointer; margin: 10px; height: 0px; width: 50px; background-color: black; background-size: cover; background-position: center; opacity: 0;
}
.track_button { position: absolute; color: #d8e9f0; font-family: "Roboto", sans-serif; font-size: 15px; letter-spacing: 2px; cursor: pointer; font-weight: 600; bottom: -30px; width: 150px; height: 25px; animation-name: grow; animation-duration: 2s; animation-fill-mode: forwards; margin-left: 75px; margin-top: 50px; background-color: #41b3ff; border: 0px; border-radius: 50px; box-shadow: -6px -6px 4px rgba(0, 0, 0, 0.3); z-index: 9;
}
.pretty_visual { position: absolute; width: 120px; height: 10px; top: 450px; margin-left: 500px; opacity: 0; animation-name: scrollLeft; animation-duration: 2s; animation-fill-mode: forwards; background-color: #ff847c;
}
@keyframes scrollUp { from { bottom: 20px; } to { bottom: 70px; }
}
@keyframes scrollRight { from { margin-left: -150px; } to { margin-left: -50px; }
}
@keyframes fadeUp { from { height: 0px; opacity: 0; } to { height: 100px; opacity: .8; }
}
@keyframes selectionFade { from { opacity: 0; height: 0px; } to { opacity: 1; height: 80px; }
}
@keyframes scrollLeft { from { margin-left: 500px; opacity: 0; } to { margin-left: 420px; opacity: 1; }
}
@keyframes grow { from { width: 150px; height: 25px; } to { width: 300px; height: 50px; }
}
@keyframes scrollDown { from { padding-top: 0px; opacity: 0; } to { padding-top: 20px; opacity: .3; }
}
Artist Card Widget - Script Codes JS Codes
"use strict";
//Arrays, functions and variables
var card_backgrounds = ["https://i.ytimg.com/vi/4EisZRNaqzg/maxresdefault.jpg", "http://unitedkpop.com/wp-content/uploads/2015/06/Psy_1424218560_af_org.jpg", "http://photon.hypb.st/hypetrak.com/images/2015/09/ezra-koenig-of-vampire-weekend-shares-home-recordings-from-1989-1.jpg"];
var names = ["Hyuna", "Psy", "Ezra Koenig"];
var genres = ["K-pop", "K-pop", "Indie"];
//used for changing cards
var cardCount = 1;
var toggle = 0;
//reinitializing the css animation for each new card.
function cardAnimation(image) { $(".placement_number").hide().fadeIn(); $(".artist_name").hide().fadeIn(); $(".pretty_visual").hide().fadeIn(); $(".artist_genre").hide().fadeIn();
}
//displaying or not display buttons depending on where user is in card track.
function checkButtons() { if (cardCount != names.length) { $(".right_button").show(); } if (cardCount == names.length) { $(".right_button").hide(); } if (cardCount == 1) { $(".left_button").hide(); } if (cardCount != 1) { $(".left_button").show(); }
}
function changeCard() { //change the background to the right background image stored in the backgrounds array. $("#card").css("background-image", "url('" + card_backgrounds[cardCount - 1] + "')"); //get the artists name from the array, make it uppercase $(".artist_name").html(names[cardCount - 1].toUpperCase()); //Change the card number on the card. $(".placement_number").html("0" + cardCount); cardAnimation(card_backgrounds[cardCount - 1]); $(".artist_genre").html(genres[cardCount - 1].toUpperCase()); checkButtons();
}
//Use Jsx to make the cards.
var Card = React.createClass({ displayName: "Card", getDefaultProps: function getDefaultProps() { return { cardNumber: 1 }; }, cardForwards: function cardForwards() { this.setProps({ cardNumber: 2 }); alert("hi"); }, render: function render() { return React.createElement( "div", null, React.createElement( "div", { id: "card" }, React.createElement(Visual, null), React.createElement(Genre, null), React.createElement(Name, null), React.createElement(Place, null), React.createElement(Buttons, null), React.createElement(Track, null) ) ); }
});
var Track = React.createClass({ displayName: "Track", render: function render() { return React.createElement( "div", { className: "card_track" }, React.createElement(TrackCards, null) ); }
});
var TrackCards = React.createClass({ displayName: "TrackCards", render: function render() { var cardOne = { backgroundImage: 'url(' + card_backgrounds[0] + ')' }; var cardTwo = { backgroundImage: 'url(' + card_backgrounds[1] + ')' }; var cardThree = { backgroundImage: 'url(' + card_backgrounds[2] + ')' }; return React.createElement( "div", null, React.createElement("div", { id: "selection_0", className: "card_selection", style: cardOne }), React.createElement("div", { id: "selection_1", className: "card_selection", style: cardTwo }), React.createElement("div", { id: "selection_2", className: "card_selection", style: cardThree }) ); }
});
var Genre = React.createClass({ displayName: "Genre", getDefaultProps: function getDefaultProps() { return { genre: "K-POP" }; }, render: function render() { return React.createElement( "div", { className: "artist_genre" }, this.props.genre ); }
});
var Name = React.createClass({ displayName: "Name", getDefaultProps: function getDefaultProps() { return { artistName: "HYUNA" }; }, render: function render() { return React.createElement( "div", { className: "artist_name scrollUp" }, this.props.artistName ); }
});
var Place = React.createClass({ displayName: "Place", getDefaultProps: function getDefaultProps() { return { placeNumber: "0" + 1 }; }, render: function render() { return React.createElement( "h1", { className: "placement_number scrollLeft" }, this.props.placeNumber ); }
});
var Buttons = React.createClass({ displayName: "Buttons", render: function render() { return React.createElement( "div", { className: "buttons" }, React.createElement( "button", { className: "left_button" }, React.createElement("i", { className: "fa fa-arrow-left" }) ), React.createElement( "button", { className: "right_button" }, React.createElement("i", { className: "fa fa-arrow-right" }) ), React.createElement( "button", { className: "track_button" }, "SEE TRACKS" ) ); }
});
var Visual = React.createClass({ displayName: "Visual", render: function render() { return React.createElement("div", { className: "pretty_visual" }); }
});
React.render(React.createElement(Card, null), document.querySelector("body"));
//Jquery
$(".right_button").click(function () { //increase card, initiate next card cardCount++; changeCard();
});
$(".left_button").click(function () { cardCount--; changeCard();
});
//Showing and hiding card track.
$(".track_button").click(function () { if (toggle == 0) { $(".card_track").show(); $(".card_selection").show(); $(".card_track").css("animation-name", "fadeUp"); $(".card_track").css("animation-duration", "2s"); $(".card_track").css("animation-fill-mode", "forwards"); $(".card_selection").css("animation-name", "selectionFade"); $(".card_selection").css("animation-duration", "4s"); $(".card_selection").css("animation-fill-mode", "forwards"); toggle = 1; } else { $(".card_track").hide(); $(".card_selection").hide(); toggle = 0; }
});
//selecting card from card track.
function selectCard(x) { cardCount = x; changeCard();
}
$("#selection_0").click(function () { selectCard(1);
});
$("#selection_1").click(function () { selectCard(2);
});
$("#selection_2").click(function () { selectCard(3);
});
Developer | Devin |
Username | edwin0258 |
Uploaded | November 23, 2022 |
Rating | 3 |
Size | 7,159 Kb |
Views | 22,264 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
A Pen by Devin | 1,521 Kb |
Dungeon Crawler | 11,820 Kb |
React Composer Widget | 6,528 Kb |
Snake | 12,649 Kb |
Calculator | 4,368 Kb |
Daily UI 011 - Flash Message | 3,458 Kb |
Pomodoro Clock | 5,289 Kb |
Country Generator | 5,517 Kb |
Portfolio Zipline | 5,335 Kb |
Sonar Svg | 2,495 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
A Pen by Miro Olma | Programiro | 2,342 Kb |
Slider for stackoverflow | KKOKU | 3,222 Kb |
CSS Donut Charts | Seanstopnik | 2,908 Kb |
Popup Modal | Aldlevine | 3,696 Kb |
Bootstrap Responsive Menu Drawer | JesseGlacken | 3,777 Kb |
Horizontal Navigation with Floats | Gymratpacks | 5,403 Kb |
Flying Bee | Pwsm50 | 3,711 Kb |
Parallax-ish Sliding Content | Jdsteinbach | 2,748 Kb |
Rrremark.com Overlay Highlighter | Derickruiz | 4,438 Kb |
Navier Stoke Fluid Simulation | Esimov | 8,584 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!