Skip to content

Commit bb0f55e

Browse files
author
jikeytang
committed
update
1 parent fec27aa commit bb0f55e

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

c/7/index.html

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
.inner{padding:15px;}
1818
.clearfix{overflow:hidden;_zoom:1;}
1919
.none{display:none;}
20-
.color-panle{display:none;width:379px;background:#fff;}
21-
.color-list{border-top:1px solid #ccc;border-left:1px solid #ccc;}
20+
.color-panle{display:none;width:379px;}
21+
.color-list{border-left:1px solid #ccc;}
2222
.color-list ul{float:left; width:120px;margin:0;padding:0;}
2323
.color-list li{list-style:none;float:left;width:20px;height:20px;border-bottom:1px solid #000;border-right:1px solid #000;overflow:hidden;cursor:pointer;}
2424
.color-read{padding-bottom:5px;height:25px;}
@@ -105,7 +105,8 @@
105105
this.render()
106106
},
107107
__dom : {
108-
__list : '.color-list'
108+
__list : '.color-list',
109+
__show : '.color-show'
109110
},
110111
setDom : function(){
111112
this.getDom(this.__dom)
@@ -137,7 +138,7 @@
137138

138139
div.id = 'panel'
139140
div.innerHTML = this.tpl[0]
140-
div.style.top = pos.top + 78 + 'px'
141+
div.style.top = pos.top + 52 + 'px'
141142
div.style.left = pos.left + 'px'
142143
div.children[0].style.display = 'block'
143144
this.container.appendChild(div)
@@ -158,11 +159,13 @@
158159
return html
159160
},
160161
createColors : function(one, arr){
161-
var colors = '<ul>'
162+
var colors = '<ul>',
163+
item
162164

163165
for (var i = 0; i < 6; i++) {
164166
for(var j = 0; j < 6; j++) {
165-
colors += '<li style="background:#' + one + arr[j] + arr[i] + '"></li>'
167+
item = one + arr[j] + arr[i]
168+
colors += '<li data-color="' + item + '" style="background:#' + item + '"></li>'
166169
}
167170
}
168171
colors += '</ul>'
@@ -179,7 +182,15 @@
179182
})
180183

181184
dog.on(self.panel, 'click', function(e){
182-
alert(111);
185+
var target = e.target,
186+
color = '#' + target.getAttribute('data-color')
187+
188+
self.input.value = color
189+
self.__show.style.background = color
190+
191+
setTimeout(function(){
192+
document.body.style.background = color
193+
}, 150)
183194
e.stopPropagation()
184195
})
185196

@@ -197,18 +208,12 @@
197208
}
198209
})
199210
},
200-
handlerLi : function(node, type){
201-
var self = this
202-
203-
if(type == 0){
204-
node.style.position = 'absolute'
205-
node.style.width = '50px'
206-
node.style.height = '50px'
207-
} else {
208-
node.style.position = 'static'
209-
node.style.width = '20px'
210-
node.style.height = '20px'
211+
handlerLi: function(node, type){
212+
var v = 0
213+
if(!type){
214+
v = '5px'
211215
}
216+
node.style.borderRadius = v
212217
}
213218
}
214219

0 commit comments

Comments
 (0)