jQuery Window
Set the width property of the jqxWindow.
Author: http://jqwidgets.com
HTML
<link rel="stylesheet" href="http://jqwidgets.com/public/jqwidgets/styles/jqx.base.css">
<link rel="stylesheet" href="http://jqwidgets.com/public/jqwidgets/styles/jqx.energyblue.css">
<script src="http://jqwidgets.com/public/jqwidgets/jqx-all.js"></script>
<div id='content'>
<div id='jqxWidget'>
<table>
<tr>
<td>color</td>
<td>
<div style="margin: 3px; float: left;" id="dropDownButton">
<div style="padding: 3px;">
<div id="colorPicker">
</div>
</div>
</div>
</td>
</tr>
</table>
</div>
<div id="DLG">
<div>Color in a Windows</div>
<div style="overflow : auto;">
<div style="margin: 3px; float: left;" id="dropDownButton2">
<div style="padding: 3px;">
<div id="colorPicker2" />
</div>
</div>
<div id="footer" style="clear:both;text-align:right;">
</div>
</div>
</div>
</div>
JavaScript
function getTextElementByColor(color) {
if (color == 'transparent' || color.hex == "") {
return $("<div style='text-shadow: none; position: relative; padding-bottom: 2px; margin-top: 2px;'>transparent</div>");
}
var element = $("<div style='text-shadow: none; position: relative; padding-bottom: 2px; margin-top: 2px;'>#" + color.hex + "</div>");
var nThreshold = 105;
var bgDelta = (color.r * 0.299) + (color.g * 0.587) + (color.b * 0.114);
var foreColor = (255 - bgDelta < nThreshold) ? 'Black' : 'White';
element.css('color', foreColor);
element.css('background', "#" + color.hex);
element.addClass('jqx-rc-all');
return element;
}
var theme = 'energyblue';
$("#colorPicker").jqxColorPicker({
color: "ffaabb",
colorMode: 'hue',
width: 220,
height: 200,
theme: theme
});
$("#dropDownButton").jqxDropDownButton({
width: 150,
height: 22,
theme: theme
});
$("#dropDownButton").jqxDropDownButton('setContent', getTextElementByColor(new $.jqx.color({
hex: "ffaabb"
})));
$("#DLG").jqxWindow({
width: 200,
height: 200,
theme: theme,
maxHeight: 800,
isModal: true,
resizable: true,
modalOpacity: 0.2
});
$("#colorPicker2").jqxColorPicker({
color: "ffaabb",
colorMode: 'hue',
width: 220,
height: 200,
theme: theme
});
$("#dropDownButton2").jqxDropDownButton({
width: 150,
height: 22,
theme: theme,
popupZIndex: 20000
});
$("#dropDownButton2").jqxDropDownButton('setContent', getTextElementByColor(new $.jqx.color({
hex: "ffaabb"
})));
$(document).mouseup(function(event) {
if (event.target.closest('#dropDownButton2') === null &&
event.target.closest('.jqx-dropdownbutton-popup') === null) {
$("#dropDownButton2").jqxDropDownButton('close');
}
});