-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
156 lines (151 loc) · 6.72 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
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
151
152
153
154
155
156
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>vue Autoscroll</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<style>
.fa-rotate-45 {
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
}
</style>
</head>
<body>
<div id="app">
<div class="container">
<div class="row justify-content-center">
<h1>vue-autoscroll</h1>
</div>
<div class="row justify-content-center">
<div class="col-10 col-sm-6 col-md-4" style="height: 300px;">
<div class="w-100 h-100 border border-secondary" v-autoscroll:noscroll="autoscroll">
<img src="./36520.jpg" width="500">
</div>
</div>
</div>
<div class="row justify-content-center">
<div class="col-12 text-center">
<div class="text-center">
<h6 v-if="isObject"><code>v-autoscroll:noscroll="{{autoscroll}}"</code></h6>
<h6 v-else><code>v-autoscroll:noscroll="'{{autoscroll}}'"</code></h6>
</div>
</div>
</div>
<div class="row justify-content-center">
<div class="col-6 col-sm-4">
<div class="row justify-content-center">
<div class="col-12 col-sm-12 col-md-8">
<div class="text-center mb-1">
<button class="btn btn-sm" @click="autoscrollTest('top')"><i class="fa fa-arrow-up"></i></button>
</div>
<div class="text-center mb-1">
<button class="btn btn-sm" @click="autoscrollTest('left')"><i class="fa fa-arrow-left"></i></button>
<button class="btn btn-sm" @click="autoscrollTest('center')"><i class="fa fa-circle"></i></button>
<button class="btn btn-sm" @click="autoscrollTest('right')"><i class="fa fa-arrow-right"></i></button>
</div>
<div class="text-center mb-1">
<button class="btn btn-sm" @click="autoscrollTest('bottom')"><i class="fa fa-arrow-down"></i></button>
</div>
</div>
</div>
</div>
<div class="col-6 col-sm-4">
<div class="row justify-content-center">
<div class="col-12 col-sm-12 col-md-8">
<div class="text-center mb-1">
<button class="btn" @click="autoscrollTest('top left')"><i class="fa fa-angle-double-left fa-rotate-45"></i></button>
<button class="btn" @click="autoscrollTest('top center')"><i class="fa fa-angle-double-up"></i></button>
<button class="btn" @click="autoscrollTest('top right')"><i class="fa fa-angle-double-up fa-rotate-45"></i></button>
</div>
<div class="text-center mb-1">
<button class="btn" @click="autoscrollTest('left center')"><i class="fa fa-angle-double-left"></i></button>
<button class="btn" @click="autoscrollTest('center')"><i class="fa fa-circle"></i></button>
<button class="btn" @click="autoscrollTest('right center')"><i class="fa fa-angle-double-right"></i></button>
</div>
<div class="text-center mb-1">
<button class="btn" @click="autoscrollTest('bottom left')"><i class="fa fa-angle-double-down fa-rotate-45"></i></button>
<button class="btn" @click="autoscrollTest('bottom center')"><i class="fa fa-angle-double-down"></i></button>
<button class="btn" @click="autoscrollTest('bottom right')"><i class="fa fa-angle-double-right fa-rotate-45"></i></button>
</div>
</div>
</div>
</div>
<div class="col-12 col-sm-4 mt-3">
<div class="row justify-content-center">
<div class="col-12 col-sm-12 col-md-12">
<div class="input-group">
<div class="input-group-prepend">
<select v-model="type" class="custom-select" id="inputGroupSelect01">
<option selected value="absolute">absolute</option>
<option value="relative">relative</option>
</select>
</div>
<input v-model="x" type="text" aria-label="First name" class="form-control" placeholder="x">
<input v-model="y" type="text" aria-label="Last name" class="form-control" placeholder="y">
<div class="input-group-append">
<button @click="scroll()" class="btn btn-secondary" type="button" id="button-addon2">Scroll</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col">
<p class="text-justify">
<h5>Tips :</h5> <strong>:noscroll</strong> argument will set <code>overflow: hidden;</code> to the element, you can use it to hide scrollbars
</p>
</div>
</div>
<div class="row">
<div class="col">
<a href="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/donmbelembe/vue-autoscroll" target="_blank" class="text-warning">
<i class="fa fa-github"></i> View on Github (Documentation)
</a>
<br>
<a href="https://unpkg.com/vue-autoscroll" target="_blank" class="text-danger">
<i class="fa fa-bookmark"></i> CDN : https://unpkg.com/vue-autoscroll
</a>
<br>
<a href="https://www.npmjs.com/package/vue-autoscroll" target="_blank" class="text-info">
<i class="fa fa-bookmark"></i> NPM : <code>npm install --save vue-autoscroll</code>
</a>
</div>
</div>
</div>
</div>
<script src="https://unpkg.com/[email protected]"></script>
<script src="./dist/vue-autoscroll.js"></script>
<script>
new Vue({
el: '#app',
data: {
x: 0,
y: 0,
type: 'relative',
autoscroll: 'center'
},
computed: {
isObject: function() {
return typeof this.autoscroll === 'object'
}
},
methods: {
autoscrollTest (value) {
this.autoscroll = value
},
scroll() {
this.autoscroll = { x: parseInt(this.x), y: parseInt(this.y), type: this.type}
}
}
})
</script>
</body>
</html>