Random Quote Generator
How do I make an random quote generator?
Displays random quotes on notecards and has an animation to shuffle it to the back when the next card is viewed.. What is a random quote generator? How do you make a random quote generator? This script and codes were developed by Zoite on 29 November 2022, Tuesday.
Random Quote Generator - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Random Quote Generator</title> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<main ng-app="QuoteApp" ng-controller="MainCtrl"> <div class="container"> <article class="back"></article> <article id="mainCard"> <h1>English flash cards</h1> <p>{{quote}} - {{author}}</p> <footer><a class="tweet" href="https://twitter.com/home?status={{quote}}" target="_blank">tweet</a><a class="next" ng-click="nextCard()">next</a></footer> </article> </div>
</main> <script src='http://ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Random Quote Generator - Script Codes CSS Codes
@import url(https://fonts.googleapis.com/css?family=Open+Sans);
body { background-color: #fafafa; overflow: hidden;
}
.container { position: relative; width: 40%; margin: 0 auto; height: 300px; margin-top: 35px;
}
article, article:before, article:after { position: absolute; top: 0; left: 0; bottom: 0; right: 0; margin-top: 40px; height: 100%; padding: 20px; box-shadow: 0 0 3px 1px rgba(0, 0, 0, 0.3), 5px 10px 10px rgba(0, 0, 0, 0.15); font: 200%/1.5 Open Sans, Baskerville, serif; font-size: 1.5em; background-color: #e8e5e3; background-image: -webkit-linear-gradient(rgba(38, 77, 115, 0.5) 1px, transparent 1px); background-image: linear-gradient(rgba(38, 77, 115, 0.5) 1px, transparent 1px); background-size: 100% 1.5em; background-origin: content-box;
}
.front { -webkit-animation: nextCard 1s ease-in-out; animation: nextCard 1s ease-in-out;
}
.back:before, .back:after { content: ''; position: absolute; left: 0px; top: -40px; width: 95%; height: 95%; padding: 20px; z-index: -1;
}
.back:before { -webkit-transform: rotateZ(-2deg); transform: rotateZ(-2deg);
}
.back:after { -webkit-transform: rotateZ(3deg); transform: rotateZ(3deg);
}
a { text-decoration: none; color: #2196f3;
}
footer { position: absolute; left: 0; right: 0; bottom: 32px; color: #2196f3; cursor: pointer; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;
}
footer .next { position: absolute; right: 25px;
}
footer .tweet { position: absolute; left: 25px;
}
@-webkit-keyframes nextCard { /* 0% { transform: translateX(0); } 50% { transform: translateX(700px); } 100% { transform: translateX(0); z-index: -1; } */ 25% { -webkit-transform: rotate(25deg); transform: rotate(25deg); } 50% { -webkit-transform: translateY(-400px); transform: translateY(-400px); } 75% { z-index: -1; } 100% { -webkit-transform: translateY(0); transform: translateY(0); z-index: -1; }
}
@keyframes nextCard { /* 0% { transform: translateX(0); } 50% { transform: translateX(700px); } 100% { transform: translateX(0); z-index: -1; } */ 25% { -webkit-transform: rotate(25deg); transform: rotate(25deg); } 50% { -webkit-transform: translateY(-400px); transform: translateY(-400px); } 75% { z-index: -1; } 100% { -webkit-transform: translateY(0); transform: translateY(0); z-index: -1; }
}
Random Quote Generator - Script Codes JS Codes
var app = angular.module('QuoteApp', []);
app.factory('Quote', function($http) { var url='https://api.forismatic.com/api/1.0/?method=getQuote&lang=en&format=jsonp&jsonp=JSON_CALLBACK'; return { getQuote: function() { return $http.jsonp(url);; } };
});
app.controller('MainCtrl', function($scope, Quote){ var mainCard = document.getElementById('mainCard'); $scope.nextCard = function() { mainCard.className='front'; setTimeout(function() { $scope.quote = ''; mainCard.classList.remove('front'); Quote.getQuote().success(function(d) { console.log(d); $scope.quote = d.quoteText; $scope.author = d.quoteAuthor; }) }, 1000); } // Init without animation Quote.getQuote().success(function(d) { console.log(d); $scope.quote = d.quoteText; $scope.author = d.quoteAuthor; })
});
Developer | Zoite |
Username | zoite |
Uploaded | November 29, 2022 |
Rating | 4 |
Size | 4,058 Kb |
Views | 12,144 |
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 |
Rainbow Bordered Button | 2,655 Kb |
A Pen by zoite | 3,448 Kb |
Login Form | 5,992 Kb |
Twitter Card | 2,410 Kb |
Recipe Box | 7,193 Kb |
Simple Calculator | 4,435 Kb |
File Dropper | 5,985 Kb |
Step Bar | 3,875 Kb |
Twitch Status | 5,265 Kb |
Wikipedia Search | 5,600 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 |
Mondrian | Chrisarmstrong | 2,787 Kb |
12 DAYS OF XMAS | Proto78 | 2,313 Kb |
Pure CSS Torch Light | Juliendargelos | 2,727 Kb |
Web Spiral - p5.js | TWAIN | 2,183 Kb |
SVG email test v2.0 | M_J_Robbins | 2,090 Kb |
Weather App | OmranAbazid | 2,596 Kb |
Subtle site navigation with description | Necks | 3,206 Kb |
Page Transitions in Backbone | Mikefowler | 3,691 Kb |
APortfolio | Skybutterfly | 5,174 Kb |
Foundation 5 Menu - Accessibility | Xporter | 1,999 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!