From 9ff6f9254143f7459c77fe42a24c277518460b76 Mon Sep 17 00:00:00 2001 From: Catouse Date: Thu, 9 Jul 2020 13:48:59 +0800 Subject: [PATCH] * fix dropdown menu width for colorpicker. --- CHANGES.md | 2 ++ en/CHANGES.md | 2 ++ src/js/colorpicker.js | 14 +++++++------- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 0f5e2f63c..ba4ea7de7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -69,6 +69,8 @@ ZUI 官方网站为 https://www.openzui.com/ ,并提供了[英文文档(https: * 加载指示器: * 优化了与按钮一起使用时的样式; * 优化了覆盖层的样式,减少了透明度; +* 颜色选择器: + * 修复了下拉菜单宽度问题; * 文件上传: * 优化了对远程服务器返回的 JSON 内容容错性,如果返回的 JSON 对象中没有指定 `status` 或 `result` 属性仍然视为上传成功; * 修复了对 IE 浏览器的兼容; diff --git a/en/CHANGES.md b/en/CHANGES.md index 01de925d6..e3bce9e73 100644 --- a/en/CHANGES.md +++ b/en/CHANGES.md @@ -70,6 +70,8 @@ ZUI official website is https://www.openzui.com/ and English version is availabl * Load indicator * Optimized the style used with icons. * Optimized the style of the overlay and reduced the opacity. +* Color picker + * Fixed dropdown menu width. * Uploader * Optimized the fault tolerance of JSON content called back by a remote server. It is deemed as uploaded, if no specified `status` or `result` in JSON. * Fixed the IE browser compatibility. diff --git a/src/js/colorpicker.js b/src/js/colorpicker.js index 82574448e..b4a1558df 100644 --- a/src/js/colorpicker.js +++ b/src/js/colorpicker.js @@ -120,12 +120,12 @@ }; ColorPicker.prototype.updateColors = function(colors) { - var $picker = this.$picker, - $menu = this.$menu.children('li:not(.heading)').remove(), + var $menu = this.$menu, options = this.options, - colors = colors || this.colors, - that = this; + colors = colors || this.colors, + that = this; var bestLineCount = 0; + $menu.children('li:not(.heading)').remove(); $.each(colors, function(idx, color) { that.addColor(color); bestLineCount++; @@ -139,11 +139,11 @@ }; ColorPicker.prototype.setValue = function(color, notSetInput) { - var that = this; + var that = this; var options = that.options; - var $btn = that.$btn; + var $btn = that.$btn; + var hex = ''; that.$menu.find('.cp-tile.active').removeClass('active'); - var hex = ''; var updateBtn = options.updateBtn; if (updateBtn === 'auto') { var $btnBar = $btn.find('.color-bar'); -- GitLab