Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
150 lines (144 loc) · 3.36 KB
/
Copy pathindex.html
File metadata and controls
150 lines (144 loc) · 3.36 KB
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<!DOCTYPE html>
<html>
<head>
<title>Cute Scroll</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="jquery.cutescroll.min.js"></script>
<style>
body {margin:0; font-family:'Open Sans';}
.flex{display:flex; flex-wrap:wrap; width:100%;}
.something{width:100%; height:100rem; background:green;}
.box {width:6rem; height:6rem; flex-grow:1;}
.btn {display:flex; margin:1rem; justify-content:center; align-items:center; flex-grow:1; cursor:pointer;}
</style>
<script>
var scroll='.scroll';
var scrollbox='.scrollbox';
var all='.scroll, .scrollbox';
var css={body:{overflow:'hidden'}};
//////
function randomColor(){
return '#'+Math.floor(Math.random()*16777215).toString(16);
}
//////
function b_full(){
jQuery(scroll).cuteScroll({
recreate:{
area:{
width:'100vw',
height:'100vh',
},
scroller:{
addClass:'someclass',
alwaysVisible:true,
},
element:{
body:{
overflow:'hidden',
}
},
},
});
};
function b_many(){
jQuery(scrollbox).cuteScroll({
recreate:{
area:{
width:'90vw',
height:'25vh',
},
scroller:{
alwaysVisible:true,
},
priority:10,
},
});
};
function style_dot(){
jQuery(all).cuteScroll({
update:{
bar:{
width:'2rem',
height:'2rem',
minHeight:'',
right:'0.1rem',
borderRadius:'1rem',
},
rail:{
width:'0.1rem',
right:'1.05rem',
//visible:true,
},
scroller:{
opacity:1,
},
},
});
}
function rand(){
jQuery(all).cuteScroll({
update:{
bar:{
background:randomColor(),
},
rail:{
background:randomColor(),
},
},
});
}
function b_50(){
jQuery(scroll).cuteScroll({
recreate:{
rail:{
visible:false,
},
scroller:{
//alwaysVisible:true,
},
area:{
height:'50vh'
}
}
});
};
function b_bott(){
jQuery(all).cuteScroll({jumpToBottom:true});
}
function b_top(){
jQuery(all).cuteScroll({jumpToTop:true});
}
function b_remove(){
jQuery(all).cuteScroll({remove:true});
}
function moreBlocks(e){
var s='';
for(var q=60; q>0; q--) s+=`<div class=box style="background:${randomColor()}"></div>`;
jQuery(e).append(`<div class="flex scrollbox">${s}</div>`);
}
function MoreBlocksForContent(){
moreBlocks('.content');
}
window.onload=function(){
MoreBlocksForContent();
};
</script>
</head>
<body>
<div class=scroll>
<div class=flex>
<div class=btn onclick=b_full()>Full Page</div>
<div class=btn onclick=b_50()>50vh Height</div>
<div class=btn onclick=b_many()>Many Scrollers</div>
<div class=btn onclick=style_dot()>Dot Style</div>
<div class=btn onclick=rand()>Random Color</div>
<div class=btn onclick=b_top()>Jump To Top</div>
<div class=btn onclick=b_bott()>Jump To Bottom</div>
<div class=btn onclick=b_remove()>Remove Scroller</div>
<div class=btn onclick="MoreBlocksForContent()">Add More Blocks</div>
</div>
<div class="flex content"></div>
</div>
</body>
</html>