This repository has been archived by the owner on May 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
215 lines (199 loc) · 6.9 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>copy - 基于jQuery的flash复制插件</title>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="styles/normalize.css" media="screen">
<link href="styles/font.css?family=Open+Sans:400,700" rel="stylesheet">
<link rel="stylesheet" href="styles/stylesheet.css" media="screen">
<style>
.main-content pre {
-webkit-overflow-scrolling: touch;
}
.site-footer {
bottom: 0;
margin: 0;
padding: 10px 0;
position: absolute;
left: 0;
width: 100%;
}
body {
margin-bottom: 85px;
}
html {
min-height: 100%;
position: relative;
background-color: #fff;
}
.project-name a {
color: #fff;
text-decoration: none;
}
@media screen and (min-width: 64em) {
.site-footer-inner {
margin: 0 auto;
max-width: 64rem;
padding: 0 6rem;
}
}
@media screen and (min-width: 42em) and (max-width: 64em) {
.site-footer-inner {
padding: 0 4rem;
}
}
@media screen and (max-width: 42em) {
.site-footer-inner {
padding: 0 1rem;
}
}
.demo {
background-color: #ccc;
width: 100px;
height: 100px;
}
</style>
<!-- 引用jQuery -->
<script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
<!-- 引用复制插件 -->
<script src="./index.js"></script>
<script>
$(function () {
// 设置默认swf路径, 方便后续直接使用
$.fn.copy.defaults.path = './copy.swf';
$('.demo').on('copy.success', function (event, data) {
alert('复制成功, 内容是: ' + data.text);
});
});
</script>
</head>
<body>
<section class="page-header">
<h1 class="project-name"><a href="https://github.com/xuexb/copy">copy</a></h1>
<h2 class="project-tagline">基于jQuery的flash复制插件</h2>
<a href="https://github.com/xuexb/copy" class="btn">github</a>
<a href="https://github.com/xuexb/copy#api" class="btn J-hash">api文档</a>
<a href="https://github.com/xuexb/copy/archive/master.zip" class="btn">下载</a>
</section>
<section class="main-content">
<div id="main">
<h1>copy</h1>
<p>基于jQuery的flash复制插件</p>
<h2>例子</h2>
<h4>普通的复制</h4>
<div class="demo1 demo">
点我
</div>
<hr />
<script>
$(function () {
$('.demo1').copy('我是复制内容');
});
</script>
<h4>开启调试模式</h4>
<div class="demo2 demo">
来吧,滑过,点击控制台都有东东.
</div>
<hr />
<script>
$(function () {
$('.demo2').copy({
text: '看控制台啊',
debug: true
});
});
</script>
<h4>复制动态的内容</h4>
<div class="demo3 demo">
点我
</div>
<textarea id="demo3-input">来吧, 少年.</textarea>
<hr />
<script>
$(function () {
$('.demo3').copy(function () {
return $('#demo3-input').val() || '真空';
});
});
</script>
<h4>定义右键菜单</h4>
<div class="demo4 demo">
点我
</div>
<hr />
<script>
$(function () {
$('.demo4').copy({
text: '菜单不错吧?',
links: [
{
name: '我是链接, 可以点击',
url: 'https://xuexb.com?rel=copy.click'
},
{
name: '我上面是不是有个边框?',
line: true
},
{
name: '被禁用的按钮',
disabled: true
}
]
});
});
</script>
<h4>链式调用</h4>
<div class="demo5 demo">
点我
</div>
<button id="demo5-btn">销毁</button>
<hr />
<script>
$(function () {
var $demo5 = $('.demo5');
var $btn = $('#demo5-btn');
var status = 1;
$btn.on('click', function () {
if (status === 1) {
$demo5.copy('destroy');
$btn.text('绑定');
status = 0;
}
else {
$btn.text('销毁');
$demo5.copy('来吧, 互相伤害.');
status = 1;
}
});
$demo5.copy('来吧, 互相伤害.');
});
</script>
<h4>事件的应用</h4>
<div class="demo6 demo">
点我
</div>
<hr />
<script>
$(function () {
$('.demo6').on('copy.success', function (event, data) {
console.log(data);
}).on('copy.mouseover', function () {
$(this).css('background-color', '#09f');
}).on('copy.mouseout', function () {
$(this).css('background-color', '#ccc');
}).copy('来吧');
});
</script>
</div>
<footer class="site-footer">
<div class="site-footer-inner">
<span class="site-footer-owner"><a href="https://github.com/xuexb/copy">Copy</a> is maintained by <a href="https://xuexb.com/?rel=copy">xuexb 前端小武</a>.</span>
<span class="site-footer-credits">This page was generated by <a href="https://pages.github.com">GitHub Pages</a> using the <a href="https://github.com/jasonlong/cayman-theme">Cayman theme</a> by <a href="https://twitter.com/jasonlong">Jason Long</a>.</span>
</div>
</footer>
</section>
</body>
</html>