-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.html
More file actions
196 lines (188 loc) · 4.7 KB
/
test.html
File metadata and controls
196 lines (188 loc) · 4.7 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
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
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>jQuery对象</title>
<style>
.container {
height: 30px;
background-color: #Eae;
}
.highlight {
color: red;
}
.red {
background-color: red;
color: #f90;
}
.green {
color: green;
}
</style>
</head>
<body>
<p>Hello</p>
<div class="container">
<span>Hello</span>
</div>
<div class="toggle" style="">Lorem ipsum dolor sit amet, consectetur adipisicing elit. A ab accusantium
beatae cumque dicta ducimus ea explicabo, hic, iusto laboriosam, modi nostrum praesentium rem rerum sapiente soluta
tempore voluptatem voluptates?
</div>
<ul>
<li>01</li>
<li>02</li>
<li>03</li>
<li>04</li>
</ul>
<ul>
<li>01</li>
<li>02</li>
<li>03</li>
<li>04</li>
</ul>
<div id="d1"></div>
<!--<script src='jquery-2.0.3.js'></script>-->
<script src='node_modules/jquery/dist/jquery.js'></script>
<script>
$('p').data('name','hello');
console.log($('p').data('name'));
$(function () {
$('ul').on('click', 'li', {name: 'hello'}, function () {
$(this).css('background-color', 'red');
});
// $('ul li:first').css('background-color','green');
$('ul li:first-child').css('background-color', 'yellow');
$('#d1').css({
backgroundColor: 'red',
width: '200px',
height: '200px'
});
});
var defer=$.Deferred();
defer.done=function(){
count*=-1;
}
$('#d1').data('count',1);
$('#d1').on('click',function(){
$('#d1').data('count',$('#d1').data('count')*(-1));
});
$('#d1').on('click',function(){
var a;
if($('#d1').data('count')>0){
return;
}else{
if(parseInt(parseInt($(this).width()))>=400){
a='100px';
}else{
a='400px';
}
var css={
width:a ,
height:a
};
}
$(this).animate(css,1000,arguments.callee);
});
/*$('#d1').on('click',function(){
$(this).animate({width:'400px',height:'400px'},'slow',function(){
$(this).animate({width:'100px'},'slow',function(){
});
});
});*/
/* (function (document) {
var div = document.getElementById('d1');
div.onclick = function () {
div.dataset.count= div.dataset.count || 0;
if (div.dataset.count % 2===0) {
div.dataset.count = 1;
grow();
} else {
div.dataset.count = 0;
pause();
}
}
var timer;
function grow() {
var count = 1;
timer = setInterval(function () {
var width = parseInt(div.style.width),
height = parseInt(div.style.height);
width += 2 * count;
height += 2 * count;
if (width >400||width<100) {
count *= -1;
}
div.style.width = width + 'px';
div.style.height = height + 'px';
}, 40);
}
function pause(){
clearInterval(timer);
timer = null;
}
})(document)*/
</script>
<!--<script src="node_modules/jquery/tmp/jquery.js"></script>-->
<!--<script>
$('.container').click(function () {
$('span', this).toggleClass('highlight');
})
$('<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam blanditiis eligendi, facilis illum minus neque nihil ut. Alias architecto cumque deserunt ea esse et maxime molestiae, molestias, quibusdam quod rem.</p>').appendTo('body');
$('<div></div>',{
'class':'red',
text:'click me',
click:function(){
$(this).toggleClass('green');
}
}).appendTo('body');
$('.toggle').click(function(){
$(this).slideUp();
});
</script>-->
<!--<script>
$=function(){};
$.extend = function () {
var target = arguments[0],
args = arguments;
function clone(target, args) {
var props;
for (var i = 0; i < args.length; i++) {
var arg = args[i];
for (key in arg) {
//如果是对象或者数组
if (typeof arg[key] === 'object') {
if (arg[key] instanceof Array) {
props = key in target ? target[key] : [];
} else {
props = key in target ? target[key] : {};
}
clone(props, arg[key]);
props = key;
target[props] = arg[key];
} else if (typeof arg[key] === 'function') {//函数
props = key;
target[props] = arg[key];
} else {
props = key;
target[props] = arg[key];
}
}
;
}
}
if (typeof target === 'boolean') {
target = arguments[1];
console.log(arguments);
console.log(111);
if (args) {
clone(target,[].slice.call(arguments,2));
}
}
}
var a = {};
$.extend(true,a, {b: 1, name: 'hello'}, {c: 'nihao', d: {age: 45}});
console.log(a);
</script>-->
</body>
</html>