-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
67 lines (65 loc) · 2.11 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Timeline</title>
<link rel="stylesheet" href="styles.css">
<style>
body {
font-family: Arial;
background-color: silver;
font-size: 30vw;
text-align: center;
}
</style>
</head>
<body>
<div class="timeline show-all" data-async="1" data-orientation='left'></div>
<div class="timeline" data-min=2015 data-max=1970 data-step=-1 data-orientation='bottom'></div>
<div class="timeline" data-min=2015 data-max=1970 data-step=-1 data-orientation='right' data-highlight='1'></div>
<div class="content">
</div>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="dn-slider.js"></script>
<script>
$( document ).ready(function() {
// Populate content for Demo
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min)) + min;
}
function setContent(){
$('.content').html('');
for (var i = 2015+getRandomInt(-2,3); i >= 1970; i=i-getRandomInt(3,10)) {
$('.content').append('<div class="year-container" data-year='+i+'></div><div class="year-column">'+i+'<br><br></div>');
};
}
setContent();
$(document).on('keyup', function(event) {
console.log(event.originalEvent.key);
if(event.originalEvent.key=='r') {
setContent();
$('.timeline').each(function(index, el) {
$(this).data('dnSlider').reloadScrollItems();
});
}
});
// Plugin Values can be set with data attributes or on init here:
$timeline = $('.timeline').dnSlider({
scrollTop: 100,
// min: 0,
// max: 100,
// step: 1,
// scrollTargetClass: '.year-container',
// scrollTargetAttr: 'data-year',
// scrollTop: 80,
debug: true,
// onChange(e) {}
});
});
</script>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</body>
</html>