gpt4 book ai didi

css - 如何使 summernote 的调色板具有响应性?

转载 作者:太空宇宙 更新时间:2023-11-04 10:11:19 25 4
gpt4 key购买 nike

我对 summernote 编辑器中的调色板外观有疑问。当显示调色板并且我减小浏览器窗口的大小时,我看到一半的颜色没有显示。我想要的是找到一种使调色板具有响应性的方法,以便看到所有颜色。

截图:

问题是这样的: colors palette not responsive

现在我正在考虑的解决方案(我不知道如何实现)是让调色板像“图像选项”一样响应。

这是它最初的样子: image options

这就是响应式的方式:

image options responsiveness

那么,我们怎样才能实现这种响应能力呢??

最佳答案

一直以来,我必须在单击颜色插入符时为调色板实现调整大小的功能:

   $('div[data-name="color"]').on('click', function (e) {
var rt = ($(window).width() - ($('div[data-name="color"]').offset().left + $('div[data-name="color"]').outerWidth())); //get offset on the right
var lt = $('div[data-name="color"]').offset().left; //get offset on the left

var $colorsPalette = $('[data-name="color"] ul.dropdown-menu');

//if language is arabic and the offset on the left is not big enough to display the horizontal palette>> then display a vertical palette
if ((__IsArabic == '1' && lt < 340) || (__IsArabic != '1' && rt < 340)) //smaller size needed
{
//here I add en empty row to keep distance between the background colors (at the top) and the font colors (bottom)
if (($colorsPalette.find('li').children().length == 2) && !$(this).parent().hasClass('open')) { //just opened

//make changes to style to display it correctly
$colorsPalette.find('.btn-group').first().after('<div class="btn-group" style="margin-top: 30px;"></div>');
$colorsPalette.css({ 'min-width': '120px', 'height': '470px' });
$colorsPalette.find('li').css({ 'width': '120px' });
$colorsPalette.find('li').children().each(function () { $(this).css({ 'margin-right': '5px', 'margin-left': '5px' }) });
$colorsPalette.find('li').children(":nth-child(2)").width(120);
}

} else {

if ($colorsPalette.find('li').children().length == 3) {
// undo the changes made (palette back to normal)
$colorsPalette.find('li').children(":nth-child(2)").remove();
$colorsPalette.find('li').children().each(function () { $(this).css({ 'margin-right': '', 'margin-left': '' }) });
$colorsPalette.find('li').css({ 'width': '338px' });
$colorsPalette.css({ 'min-width': '340px', 'height': '' });
}

}

});

希望对遇到同样问题的人有所帮助

关于css - 如何使 summernote 的调色板具有响应性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37577288/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com