|
17 | 17 | .inner{padding:15px;}
|
18 | 18 | .clearfix{overflow:hidden;_zoom:1;}
|
19 | 19 | .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;} |
22 | 22 | .color-list ul{float:left; width:120px;margin:0;padding:0;}
|
23 | 23 | .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;}
|
24 | 24 | .color-read{padding-bottom:5px;height:25px;}
|
|
105 | 105 | this.render()
|
106 | 106 | },
|
107 | 107 | __dom : {
|
108 |
| - __list : '.color-list' |
| 108 | + __list : '.color-list', |
| 109 | + __show : '.color-show' |
109 | 110 | },
|
110 | 111 | setDom : function(){
|
111 | 112 | this.getDom(this.__dom)
|
|
137 | 138 |
|
138 | 139 | div.id = 'panel'
|
139 | 140 | div.innerHTML = this.tpl[0]
|
140 |
| - div.style.top = pos.top + 78 + 'px' |
| 141 | + div.style.top = pos.top + 52 + 'px' |
141 | 142 | div.style.left = pos.left + 'px'
|
142 | 143 | div.children[0].style.display = 'block'
|
143 | 144 | this.container.appendChild(div)
|
|
158 | 159 | return html
|
159 | 160 | },
|
160 | 161 | createColors : function(one, arr){
|
161 |
| - var colors = '<ul>' |
| 162 | + var colors = '<ul>', |
| 163 | + item |
162 | 164 |
|
163 | 165 | for (var i = 0; i < 6; i++) {
|
164 | 166 | 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>' |
166 | 169 | }
|
167 | 170 | }
|
168 | 171 | colors += '</ul>'
|
|
179 | 182 | })
|
180 | 183 |
|
181 | 184 | 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) |
183 | 194 | e.stopPropagation()
|
184 | 195 | })
|
185 | 196 |
|
|
197 | 208 | }
|
198 | 209 | })
|
199 | 210 | },
|
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' |
211 | 215 | }
|
| 216 | + node.style.borderRadius = v |
212 | 217 | }
|
213 | 218 | }
|
214 | 219 |
|
|
0 commit comments