-
Notifications
You must be signed in to change notification settings - Fork 12
/
example.html
128 lines (122 loc) · 4.44 KB
/
example.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Scrolltab Demo</title>
<style>
* {padding: 0; margin: 0}
.scrolltab-item {
padding: 5px 20px;
color: white;
-webkit-border-top-left-radius: 10px;
-webkit-border-bottom-left-radius: 10px;
-moz-border-radius-topleft: 10px;
-moz-border-radius-bottomleft: 10px;
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
}
.scrolltab-item {
width: 50px;
height: 20px;
border: 1px solid white;
border-right: none;
background-color: blue;
}
.scrolltab-item1 {
width: 50px;
height: 20px;
border: 1px solid white;
border-right: none;
background-color: green;
}
.scrolltab-item2 {
width: 50px;
height: 20px;
border: 1px solid white;
border-right: none;
background-color: purple;
}
.scrolltab-item3 {
width: 50px;
height: 20px;
border: 1px solid white;
border-right: none;
background-color: yellow;
}
body { background-color: #e7e7e7}
.scrolltab { padding: 20px; }
#header h1 { padding: 10px 0;}
#options { position: fixed; left: 5px; top: 60px; background-color: white; border: 1px solid black; padding: 20px; }
.test1 { height: 200px; background-color: blue; }
.test2 { height: 2000px; background-color: green; }
.test3 { height: 900px; background-color: purple; }
.test4 { height: 300px; background-color: yellow; }
.test5 { height: 400px; background-color: purple; border-top: 3px solid white; color: white; }
.container { width: 960px; margin: 0 auto; }
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="jquery.scrolltab.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var boxCount = 0;
// Have all scroll tabs expand on mouseover and detract on mouseleave
$('.scrolltab')
.click(function() {$(this).slideUp(); })
.scrolltab({
mouseenter: function() {
$(this).stop().animate({width: '200px'}, 500);
},
mouseleave: function() {
$(this).stop().animate({width: '50px'}, 500);
}
});
// Change three of the pins to a specific classname (instead of the default)
$('.test2').scrolltab({classname: 'scrolltab-item1 scrolltab-item'});
$('.test3').scrolltab({classname: 'scrolltab-item2 scrolltab-item'});
$('.test4').scrolltab({classname: 'scrolltab-item3 scrolltab-item'});
// Change all future created tabs
$.fn.scrolltab.defaults = $.extend($.fn.scrolltab.defaults, {
mouseenter: function() {
$(this).stop().animate({width: '200px'}, 500);
},
mouseleave: function() {
$(this).stop().animate({width: '50px'}, 500);
}
});
// Demo Options
$('#box-add').on('click', function(e) {
e.preventDefault();
var newboxTitle = 'Box ' + ++boxCount;
var $newBox = $('<div class="scrolltab test5"/>');
$newBox.append('<h4>' + newboxTitle + '</h4>');
$('.container').append($newBox);
$newBox
.click(function() { $(this).slideUp(); })
.scrolltab({classname: 'scrolltab-item2 scrolltab-item', title: newboxTitle});
return false;
});
$('#box-showall').on('click', function(e) {
e.preventDefault();
$('.scrolltab').slideDown();
});
});
</script>
</head>
<body>
<div class="container">
<div id="header">
<h1>Scrolltab Demo</h1>
</div>
<div id="options">
<a href="#" id="box-add">Add Box</a><br/>
<a href="#" id="box-showall">Show All</a><br/>
<p>Click on a box to hide it.</p>
</div>
<div class="scrolltab test1" data-st-title="Title"></div>
<div class="scrolltab test2"></div>
<div class="scrolltab test3"></div>
<div class="scrolltab test4"></div>
</div>
</body>
</html>