diff --git a/index.html b/index.html index c28edec..9b9d8e8 100644 --- a/index.html +++ b/index.html @@ -23,9 +23,12 @@ - + +
Zoom
- + @@ -73,7 +76,7 @@ const paletteColors = ['#FF4B4B','#FFA500','#FFD700','#4CAF50','#00BCD4','#2196F3','#9C27B0','#795548','#000000']; const $palette = $('#color-palette'); - $palette.css({ display:'grid', gridTemplateColumns:'repeat(3,28px)' }); + $palette.css({ gridTemplateColumns:'repeat(3,28px)' }); paletteColors.forEach(c => { // ZMIANA TUTAJ: Dodajemy width, height, border i cursor @@ -101,11 +104,12 @@ }); $('#btn-change-color').on('click', function() { - const off = $(this).offset(); - $palette.css({ top: off.top + 36, left: off.left }).toggle(); + $palette.toggleClass('active'); }); $(document).on('click', function(e) { - if (!$(e.target).closest('#color-palette,#btn-change-color').length) $palette.hide(); + if (!$(e.target).closest('#color-palette,#btn-change-color').length) + if($palette.hasClass('active')) + $palette.toggleClass('active'); }); diff --git a/style.css b/style.css index e106977..1d5a8e9 100644 --- a/style.css +++ b/style.css @@ -262,3 +262,17 @@ body { top: auto; } } + +/* color wrapper */ +.color-wrapper{ + display: flex; + flex-direction: column; + position: relative; +} +#color-palette{ + display:none; + top: 41px; +} +#color-palette.active{ + display: grid!important; +} \ No newline at end of file