"Random Quote Machine Application "
Bootstrap 3.3.0 Snippet by ziaongit

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="keywords" content="HTML,CSS, Bootstrap, JavaScript, jQuery">
<meta name="author" content="Zia">
<meta name="Random Quote Machine Application" content="Random Quote Machine with HTML, CSS, Bootstrap, and jQuery. I a user click on a button it shows a new random quote. The user can also share out a quote by simply clicking a button on social media.">
<title>Random Quote Machine Application</title>
</head>
<body>
<div class="container vertical-center">
<div class="col-md-10 offset-md-1 mb-2">
<h1>Top 100 quotes of all time.</h1>
<blockquote class="quote-card green-card">
<p id="quote">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Doloremque at, architecto culpa sint veniam temporibus!!
</p>
<cite>
<span id="author"></span>
</cite>
</blockquote>
<a id="twitter" class="btn btn-lg btn-social btn-twitter"> <i class="fa fa-twitter"></i>Tweet Quote</a>
<button class="btn btn-success pull-right" id="randomQuote">New Quote</button>
</div>
</div>
</body>
</html>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
@charset "UTF-8";
@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,200italic);
@import url(https://fonts.googleapis.com/css?family=Romanesco);
@import url(https://fonts.googleapis.com/css?family=Lobster);
@import url(https://fonts.googleapis.com/css?family=Pacifico);
@import url(https://fonts.googleapis.com/css?family=IM+Fell+DW+Pica+SC);
@import url(//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css);
@charset "UTF-8";
@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,200italic);
body {
background-image: url(https://raw.githubusercontent.com/ziaongit/Random-Quote-Machine-Application/master/resources/images/background.jpg);
background-size: cover;
background-repeat: no-repeat;
display: table;
font-family: 'Source Sans Pro', sans-serif;
font-weight: 300;
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}
h1{
font-family: 'Lobster', cursive;
text-shadow: 2px 2px #00970b;
text-align: center;
color: #ffffff;
padding-bottom: 10px;
}
.vertical-center {
min-height: 100%;
min-height: 100vh;
display: flex;
align-items: center;
}
.text-center {
text-align: center;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var randomQuote;
var currentIndex;
var quoteText;
var quoteAuthor;
$(document).ready(function() {
getRandomQuote();
$('#randomQuote').click(getRandomQuote);
$('#twitter').click(shareTweet);
function getRandomQuote(){
$.getJSON("https://talaikis.com/api/quotes/", function(data) {
generateQuote(data);
});
}
function generateQuote(quotes) {
do {
var QuotesIndex = Math.floor(Math.random() * quotes.length);
}while(currentIndex === QuotesIndex)
randomQuote = quotes[QuotesIndex];
quoteText = randomQuote.quote;
quoteAuthor = randomQuote.author;
currentIndex = QuotesIndex;
$('#quote').html(randomQuote.quote);
$('#author').html('- '+randomQuote.author);
}
function shareTweet() {
if(quoteText.length > 100) {
quoteText = quoteText.substr(0, 100).match(/(^.+)\s/)[1]+ '...';
}
window.open('https://twitter.com/intent/tweet?text='+quoteText+' - '+quoteAuthor);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: