-
Notifications
You must be signed in to change notification settings - Fork 98
/
index.html
147 lines (127 loc) · 2.63 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
<!DOCTYPE html>
<html>
<head>
<title>lg-swiper</title>
<meta name="viewport" content="width=400, user-scalable=no, minimal-ui">
</head>
<!-- build:css -->
<link rel="stylesheet" type="text/css" href="./dist/swiper.css" />
<!-- endbuild -->
<style>
*{
margin: 0;
padding: 0;
}
html, body{
height: 100%;
width: 100%;
background: #DDD;
}
.ro {
height: 100%;
width: 100%;
color: #ffffff;
font-size: 64px;
background: #CCC;
/*border: #BBB 1px solid;*/
box-sizing: border-box;
}
.ro:before {
content: '';
position: absolute;
left: 100px;
top: 100px;
background: cornflowerblue;
-webkit-border-radius: 100px;
-moz-border-radius: 100px;
border-radius: 100px;
width: 100px;
height: 100px;
}
.outer-container{
position: absolute;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
/*outline: #999 1px solid;*/
}
.component{
width:100px;
height:100px;
background:red;
position:relative;
animation:mymove 5s infinite;
-webkit-animation:mymove 5s infinite;
}
@-webkit-keyframes mymove {
from {
-webkit-transform: translate3d(0, 0, 0);
}
to {
-webkit-transform: translate3d(100px, 0, 0);
}
}
</style>
<body>
<div class="outer-container">
</div>
</body>
<!-- build:js -->
<script src="./dist/swiper.js"></script>
<!-- <script src="./effect.js"></script> -->
<!-- endbuild -->
<script>
var list = [];
var types = ['slide', 'rotate', 'flip', 'card', 'fade'];
var colors = ['red', 'green', 'blue', 'orange', 'purple'];
for (var i = 0; i < 5; i++){
list.push({
content: '<div data-active="true" class="ro" style="background-color:' + colors[i] + ';">' + i + '<div class="component"></div><a href="http://baidu.com" target="_blank">xxx</a><input /></div>',
transition: {
name: types[i],
duration: 800
}
});
}
var swiper = new Swiper({
// debug: true,
data: list,
container: document.querySelector('.outer-container'),
// isVertical: false,
isLoop: false,
// initIndex: 0,
// 设定从该页面出去的效果
transition: {
name: 'slide',
// duration: 400,
// direction: 1
}
});
var events = [
'swipeBeforeStart',
'swipeStart',
'swipeChange',
'swipeChanged',
'swipeRestore',
'swipeRestored',
'activePageChanged',
'destroy'
];
swiper.on(events.join(' '), function (e) {
console.log(e.name);
})
// swiper.on('swipeChange', function () {
// console.log('swipeChange');
// });
// swiper.on('swipeChanged', function () {
// console.log('swipeChanged');
// });
// swiper.on('swipeRestore', function () {
// console.log('swipeRestore');
// });
// swiper.on('swipeRestored', function () {
// console.log('swipeRestored');
// });
</script>
</html>