From 556f05916de179e2d74c85a75441d6da11acf959 Mon Sep 17 00:00:00 2001 From: MaxOvs Date: Thu, 13 Oct 2022 12:37:27 +0300 Subject: [PATCH] Fix styles in fn disabled --- src/cg-dropdown.js | 3 +++ src/index.js | 9 +++------ src/style/main.scss | 4 ++++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/cg-dropdown.js b/src/cg-dropdown.js index 4f84846..7e63a01 100644 --- a/src/cg-dropdown.js +++ b/src/cg-dropdown.js @@ -84,10 +84,13 @@ export class DropDown { return; } + const select = this.#element.querySelector('.cg-select'); if (value === true) { this.#element.setAttribute('disabled', true); + select.classList.add('disabled'); } else { this.#element.removeAttribute('disabled'); + select.classList.remove('disabled'); } } diff --git a/src/index.js b/src/index.js index bf439cd..e2c658f 100644 --- a/src/index.js +++ b/src/index.js @@ -4,11 +4,7 @@ const dropdown = new DropDown({ selector: '.cg-dropdown_one', placeholder: 'Выберите авто', items: ['BMW', 'Opel', 'Mersedes', 'MAN', 'max'], - styles: { - head: { - background: '#4d629f', - }, - }, + multiselect: true, multiselectTag: true, }); @@ -54,9 +50,10 @@ const dropdown2 = new DropDown({ // multiselectTag: true, }); -dropdown2.addItem('LADA'); dropdown.disabled(false); +dropdown2.addItem('LADA'); + //ToDo: paste the desired url; const dropdown3 = new DropDown({ diff --git a/src/style/main.scss b/src/style/main.scss index c40fb12..90719ec 100644 --- a/src/style/main.scss +++ b/src/style/main.scss @@ -191,3 +191,7 @@ input[type='checkbox'] { ::-webkit-scrollbar-thumb { background-color: #4d4d4d; } + +.disabled { + background-color: #8f9195 !important; +}