Вопрос для тех, кто смыслит в панораме. Создал кнопку, написал для неё текст, оформил всё в css, всё прекрасно отображается. Но как только пишу скрипт для кнопки в js, всё работает, но текст кнопки пропадает. Мой код:
XML:
<root>
<styles>
<include src="file://{resources}/styles/custom_game/settingsPanel.css" />
</styles>
<scripts>
<include src="file://{resources}/scripts/custom_game/settingsPanel.js" />
</scripts>
<Panel>
<Panel id="general" class="general">
<Button id="button" class="button" onactivate="buttonPressed()">
<Panel id="TitlePanel" class ="TitlePanel">
<Label id="AddonTitle" text="Creeps" style="" />
</Panel>
</Button>
</Panel>
<Panel id ="list" class="list">
</Panel>
</Panel>
</root>
CSS:
.button {
color: white;
height: 80px;
width: 80px;
background-color: dimgray;
border-radius: 20px;
position: 0% 30% 0px;
}
.button:hover {
box-shadow: 0 0 5px black;
/* делаем свечение по краям при наведении*/
}
.button:active {
box-shadow: 0 0 5px gray;
/* делаем свечение по краям при нажатии*/
background-color: gray;
/*меняем цвет при нажатии*/
}
#AddonTitle
{
color: white;
font-size: 18px;
position: 13px 10px 0px;
}
.list {
height: 500px;
width: 500px;
background-color: dimgray;
border-radius: 20px;
position: 50% 25% 0px;
visibility: collapse;
}
JavaScript:
button = $.CreatePanel("Button", $("#general"), "button");
button.AddClass("button");
button.SetPanelEvent("onactivate", function() {
clickfunc();
});
function clickfunc() {
var panel = $( "#list" )
panel.SetHasClass('Visible', !panel.BHasClass('Visible'))
if ( panel.style.visibility == "visible" ) {
panel.style.visibility = "collapse"
} else {
panel.style.visibility = "visible"
}
}
Последнее редактирование: