JSFiddle - React, Tailwind, and code Playground
by David Kyle
HTML
<ul id="background-slider">
<!--
<li class="background-slider-item"></li>
<!-- /.background-slider-item -->
</ul>
<!-- /.background-slider -->
<div class="rotator-wrapper">
<div class="rotator-progress"></div>
<!-- /.rotator-progress -->
<div class="rotator-content">
<blockquote>
<p class="quote-text">Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.</p>
<footer class="quote-author"><span>Albert Einstein</span></footer>
<!-- /.quote-author -->
</blockquote>
<!-- /.quote-text -->
</div>
<!-- /.rotator-content -->
<div class="rotator-controls">
<button id="random-quote" class="btn">Random Quote</button>
<button id="tweet" class="btn">Tweet</button>
</div>
<!-- /.rotator-controls -->
</div>
<!-- /.rotator-wrapper -->
CSS
/*=================================
\* 0. Reset
/*===============================*/
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
display: block;
}
body {
line-height: 1;
}
ol,
ul {
list-style: none;
}
blockquote,
q {
quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
/*=================================
\* 1. Globals
/*===============================*/
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body {
background-color: transparent;
padding-top: 1px;
margin-top: -1px;
}
/*=================================
\* 2. Background slider
/*===============================*/
#background-slider:after {
content: "";
position: fixed;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .7);
z-index: -1;
}
.background-slider-item {
position: fixed;
width: 100%;
height: 100%;
background-position: center center;
z-index: -2;
}
.item-under {
z-index: -99 !important;
}
/*=================================
\* 3. Quotes...
JavaScript
var quotes = [{
"quote": "Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.",
"author": "Albert Einstein",
"bg-image": "https://krzysztof-m.github.io/quotes-rotator-with-background-slider/img/einstein.jpg"
}, {
"quote": "The artist is nothing without the gift, but the gift is nothing without work.",
"author": "Emile Zola",
"bg-image": "https://krzysztof-m.github.io/quotes-rotator-with-background-slider/img/zola.jpg"
}, {
"quote": "I find that the harder I work, the more luck I seem to have.",
"author": "Thomas Jefferson",
"bg-image": "https://krzysztof-m.github.io/quotes-rotator-with-background-slider/img/jefferson.jpg"
}, {
"quote": "Whether you think that you can, or that you can't, you are usually right.",
"author": "Henry Ford",
"bg-image": "https://krzysztof-m.github.io/quotes-rotator-with-background-slider/img/ford.jpg"
}, {
"quote": "There are no facts, only interpretations.",
"author": "Friedrich Nietzsche",
"bg-image": "https://krzysztof-m.github.io/quotes-rotator-with-background-slider/img/nietzsche.jpg"
}, {
"quote": "Try to learn something about everything and everything about something.",
"author": "Thomas Henry Huxley",
"bg-image": "https://krzysztof-m.github.io/quotes-rotator-with-background-slider/img/huxley.jpg"
}, {
"quote": "Never interrupt your enemy when he is making a mistake.",
"author": "Napoleon Bonaparte",
"bg-image": "https://krzysztof-m.github.io/quotes-rotator-with-background-slider/img/einstein.jpg"
}];
var Utilities = (function(settings) {
// top level this reference
var ns = this;
var Quotes = (function() {
// "namespace" this reference
var local = this;
// Create a quote class
var Quote = function() {
var me = this;
me.Text = "";
me.BackgroundImage = "";
me.Author = "";
me.Handle = null;
};
local.previous = -1;
local.quoteRepo = [];
local.randomNumber = function() {
...