forked from codrops/PageRevealEffects
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
executable file
·98 lines (79 loc) · 3.3 KB
/
index.html
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Build a Random Quote Machine</title>
<meta name="description" content="Some inspiration for multi-layer page reveal effects" />
<meta name="keywords" content="overlay, reveal, effect, page transition, inspiration, javascript" />
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700,600|Merriweather:400' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="css/normalize.css" />
<link rel="stylesheet" type="text/css" href="css/select-css.css" />
<link rel="stylesheet" type="text/css" href="css/demo.css" />
<link rel="stylesheet" type="text/css" href="css/component.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="js/modernizr-custom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
</head>
<body>
<main class="container">
<div class="page">
<blockquote class="quote">
<p id="quote">A good programmer is someone who always looks both ways before crossing a one-way street. </p>
<footer id="author">Doug Linder</footer>
</blockquote>
<span>
<a id="tweet" href="https://twitter.com/intent/tweet?text=" target="_blank" class="btn btn-custom"><i class="fa fa-twitter"></i></a>
<input type="button" value="New Quote" name="" id="newQuoteButton" class="btn btn-custom">
</span>
</main>
<script src="js/classie.js"></script>
<script src="js/main.js"></script>
<script>
// retreving the quote and the auther info
//end
(function() {
var pages = [].slice.call(document.querySelectorAll('.page')),
currentPage = 0,
revealerOpts = {
// the layers are the elements that move from the sides
nmbLayers : 3,
// bg color of each layer
bgcolor : ['#0092DD', '#fff', '#3E3A35'],
// effect classname
effect : 'anim--effect-3',
};
revealer = new Revealer(revealerOpts);
// clicking the page nav buttons
document.querySelector('#newQuoteButton').addEventListener('click', function() { reveal('cornerbottomright');
var url ="https://api.forismatic.com/api/1.0/?method=getQuote&format=jsonp&jsonp=?&lang=en";
$.getJSON(url, function(json){
setTimeout(function(){
$("#quote").text(json.quoteText);
$("#author").text(json.quoteAuthor);
}, 1000);
});
});
// triggers the effect by calling instance.reveal(direction, callbackTime, callbackFn)
function reveal(direction) {
var callbackTime = 750,
callbackFn = function() {
//classie.remove(pages[currentPage], 'page--current');
//currentPage = currentPage === 0 ? 1 : 0;
//classie.add(pages[currentPage], 'page--current');
};
revealer.reveal(direction, callbackTime);
}
// force it to be the first opt as default
//effectCtrl.value = 'effect-3';
})();
$("#tweet").click(function(){
var text=document.getElementById("quote").innerHTML;
var author =document.getElementById("author").innerHTML;
$(this).attr("href",'https://twitter.com/intent/tweet/?text='+ text +'-'+author);
});
</script>
</body>
</html>