我的代码遇到了一些麻烦,因为我不知道如何使图标显示在按钮内。它出现在之前或之后。有什么办法可以将我的图标插入按钮本身?
private static buttonControllModels(buttonIcon: Array<string>, buttonPos: number): JQuery {
debugger;
var $ModelSelector = $("<div class=\"" + buttonIcon + "\">");
$ModelSelector.parent().css({ position: 'relative' });
$ModelSelector.css({ top: 20, left: buttonPos, position: 'absolute' });
$.each(buttonIcon, (i, m) => {
$ModelSelector.append($("<input id=\"" + m + "\" type=\"button\" >"));
});
$ModelSelector.on("click", "input", (x: Event) => {
debugger;
var $input = <HTMLInputElement>event.target
var button;
switch ($input.id) {
case 'nw-visible': { button = 'showAll'; break; }
case 'nw-invisible': { button = 'hideAll'; break; }
case 'nw-preview': { button = 'translucentAll'; break; }
default:
}
Viewer.$viewer.viewer($input.checked ? button : button, $input.id);
});
return $ModelSelector;
}