Vanilla JS Forismatic Example
How do I make an vanilla js forismatic example?
What is a vanilla js forismatic example? How do you make a vanilla js forismatic example? This script and codes were developed by Sky on 29 January 2023, Sunday.
Vanilla JS Forismatic Example - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Vanilla JS Forismatic Example</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div id="quote-box"> <p id="quote"></p> <i id="author"></i>
</div>
<button id="new-quote">New Quote</button> <script src="js/index.js"></script>
</body>
</html>
Vanilla JS Forismatic Example - Script Codes CSS Codes
html { min-height: 100vh;
}
body { background-image: -webkit-linear-gradient( 315deg, #43CBFF 0%, #9708CC 100%); background-image: linear-gradient( 135deg, #43CBFF 0%, #9708CC 100%); color: #eee; font-family: verdana; font-size: 16px; min-width: 280px; margin: 0 auto; max-width: 600px; text-align: center;
}
#quote-box { border-left: 8px solid #D1460A; min-width: 250px; margin: 20vh auto 40px; padding: 15px 0 15px 30px; text-align: left; width: 50vw;
}
button { border: 1px solid transparent; border-radius: 3px; font-size: inherit; height: 2.25em; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; background-color: white; border-color: #dbdbdb; color: #363636; cursor: pointer;
}
Vanilla JS Forismatic Example - Script Codes JS Codes
// Get the quote on window load
window.onload = getQuote;
// register a click handler on the new quote button
document.getElementById('new-quote').onclick = getQuote;
// Append the API url as a script to the page
// The jsonp parameter defines the function to call when complete (parseQuote)
function getQuote() { document.getElementById('quote').innerHTML = "Loading ..." var s = document.createElement('script'); s.src = 'https://api.forismatic.com/api/1.0/?method=getQuote&lang=en&format=jsonp&jsonp=parseQuote'; s.id = 'script' document.body.appendChild(s);
}
// remove the script tag now that we have a response and add the quote to the page
function parseQuote(response) { document.getElementById('script').outerHTML = ""; document.getElementById("quote").innerHTML = response.quoteText; document.getElementById("author").innerHTML = response.quoteAuthor;
}
Developer | Sky |
Username | skycoder |
Uploaded | January 29, 2023 |
Rating | 3 |
Size | 2,284 Kb |
Views | 6,072 |
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 |
Random Quote Machine | 2,259 Kb |
Search box that submits when you hit Enter | 2,459 Kb |
Show the Local Weather - and a local background image | 8,205 Kb |
Colors and Sounds | 4,204 Kb |
JSONP Examples with the Dark Sky API | 5,884 Kb |
Calculator | 4,133 Kb |
Bootstrap 3 Grid Example | 2,111 Kb |
Wikipedia Viewer | 3,538 Kb |
FCC Leaderboard - vanilla JS | 2,546 Kb |
Feather Icons | 2,918 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 |
P5.js data visualization | Enginarslan | 2,233 Kb |
Animating characters with jQuery | 042 | 2,776 Kb |
Image Stack Test SCSS | CalvinMorett | 2,799 Kb |
My Interests | Anshusaxenaarora | 2,015 Kb |
Google Chrome Icon using Pure CSS in one DIV | Grssam | 3,627 Kb |
Exploring css spinners | Akagr | 3,569 Kb |
Pure CSS Menu | Bronsrobin | 3,321 Kb |
SVG Icons Template | Legofsalmon | 2,618 Kb |
We Simplify animation | Meodai | 48,169 Kb |
Hoi hoi | JohnTheCat | 7,248 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!