Skip to content

Instantly share code, notes, and snippets.

@paulinafischer
Created December 27, 2019 11:33
Show Gist options
  • Save paulinafischer/4b5f5017aa75911960f0fd548ed9c5a1 to your computer and use it in GitHub Desktop.
Save paulinafischer/4b5f5017aa75911960f0fd548ed9c5a1 to your computer and use it in GitHub Desktop.
Random Quote Machine
<head>
<link rel="stylesheet" href="path/to/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Droid+Sans+Mono|EB+Garamond|Nunito+Sans|Righteous|Yellowtail" rel="stylesheet">
</head>
</head>
<body>
 <div class = "jumbotron animated fadeIn">
<div class= "text-container text-center">
 <h1><strong>Quotes for the Soul</strong></h1>
<br>
<div id = "soul-box" class= "col-xs-12 row quoteText">
<q>Empty your mind, be formless. Shapeless, like water. If you put water into a cup, it becomes the cup. You put water into a bottle and it becomes the bottle. You put it in a teapot, it becomes the teapot. Now, water can flow or it can crash. Be water, my friend.</q> <p class="text-right"> ― Bruce Lee</p>
</div>
<div class="col-md-4>
<div class = "text-center">
<a class="btn btn-primary btn-lg" id="next" role="button"><i class="fa fa-arrow-right" aria-hidden="true"></i>
</a><br>
<br> </div>
<div class="col-md-4>
<div class = "text-center">
<a id="social" href="https://twitter.com/intent/tweet" target="_blank" class="btn btn-info btn-sm" role="button"><i class="fa fa-twitter-square" aria-hidden="true"></i></a>
<a id="social" href="https://www.facebook.com/sharer/sharer.php?u=" target="_blank" class="btn btn-info btn-sm" role="button"><i class="fa fa-facebook-square" aria-hidden="true"></i></a>
<a id="social" href="https://plus.google.com/share?url=" target="_blank" class="btn btn-info btn-sm" role="button"><i class="fa fa-google-plus-square" aria-hidden="true"></i>
</a>
</div>
</div>
</div>
</div>
</div>
<div class="panel-footer text-center"> <p>Created by: Paulina Fischer</p><p>Library from
<a href="https://www.youtube.com/channel/UCLG_lIjyLPqjN-KtHK_aE-Q" target="_blank">Happy Coder</a> and freeCodeCamp.</p></div>
</body>
$("#next").on('click', function() {
$.ajaxSetup({cache:false});
$.getJSON("https://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&callback=", function(data) {
$(".quoteText").html('"' + data[0].content + '"' + " ― " +data[0].title)
 fetch('https://source.unsplash.com/random/1300x400').then(response => response.blob()) .then(URL.createObjectURL) .then(url => $('.jumbotron').css('background-image', `url(${url})`));
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"></script>
.jumbotron{
background-image: url("http://res.cloudinary.com/dfqxzvppi/image/upload/v1497265138/bruce-lee-flying_sxqij8.jpg");
background-size: cover;
overflow: hidden;
z-index: -1;
position:realative;
width:100%;
heigth:auto;
}
.text-container {
position: relative;
background-color: rgba(0, 0, 0, 0.8);
color:#F5F5F5;
}
h3 {
color:#D3D3D3;
}
h1{
color:#DCDCDC;
font-family: 'EB Garamond', serif;
}
#soul-box {
position: relative;
background-color: rgba(0, 0, 0, 0.8);
color:#F5F5F5;
width: 80%;
left: 12%;
color:#F5F5F5;
font-size:20px;
}
#next{
background-color:black;
color:grey;
border-color: grey;
cursor:pointer;
}
#social {
background-color:black;
color:grey;
border: none;
position: relative;
cursor:pointer;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="stylesheet" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment