【问题标题】:Spectrum colorpicker not working on jQuery dialog光谱颜色选择器不适用于 jQuery 对话框
【发布时间】:2015-08-18 04:44:00
【问题描述】:

我正在尝试在 jQuery 对话框上显示 Spectrum 颜色选择器,但它没有显示出来。这是我用于加载频谱的代码:

$(document).ready(function() { $("#colour").spectrum({color: "#f00" });});

在我的 jQuery 对话框中为 div 着色。 这是初始化对话框的代码:

dialogObj = $("#_dialogPanel").dialog({
        autoOpen: false,
        resizeable: true,
        position: { my: "center-100 bottom-40", at: "center center" },
        stack: true,
        height: 'auto',
        width: 'auto',
        modal: true
    });
    $("#_dialogPanel").submit( function(e) {
        e.preventDefault();
    });
    dialogObj.dialog("open");

对话框中的内容是动态加载的:

$("#_dialogPanel").empty().html(response);
$(document).ready(function() { $("#colour").spectrum({color: "#f00" });});

“响应”:

<div name='colour' id='colour' />

对spectrum.js和spectrum.css的引用添加到母版页

【问题讨论】:

    标签: javascript jquery color-picker


    【解决方案1】:

    光谱颜色选择器不适用于 div,仅适用于输入元素

    <input type='text' id="colour" />
    

    【讨论】:

      猜你喜欢
      • 2013-10-19
      • 2016-05-08
      • 2013-08-13
      • 2013-04-26
      • 2010-12-30
      • 1970-01-01
      • 2014-05-08
      • 2013-04-23
      • 2017-06-17
      相关资源
      最近更新 更多