Ok, thanks!
How can I see if a widget is open/close in JavaScript?
I have resolve my previous question, but now I am not able to change the image of an object with JavaScript, do you know how to do it?
I tryed some istructions but no one worked..
This is my code:
How can I see if a widget is open/close in JavaScript?
I have resolve my previous question, but now I am not able to change the image of an object with JavaScript, do you know how to do it?
I tryed some istructions but no one worked..
This is my code:
Code:
$(function()
{
var widgetS = false, widgetF = false;
function openWidget(id_icon)
{
$(id_icon).css("background-image", "/scada/resources/icons/Button_Preessed.svg"); //This doesn't work
}
function closeWidget(id_icon)
{
$(id_icon).css("background-image", "/scada/resources/icons/empty.svg"); //This doesn't work
}
$(".widgetS").on("click", function()
{
if (widgetS == false)
{
openWidget(".widgetS");
widgetS = true;
}
else
{
closeWidget(".widgetS");
widgetS = false;
}
if (widgetF == true)
{
closeWidget(".widgetF");
widgetF = false;
}
});
$(".widgetF").on("click", function()
{
if (widgetF == false)
{
openWidget(".widgetF");
widgetF = true;
}
else
{
closeWidget(".widgetF");
widgetF = false;
}
if (widgetS == true)
{
closeWidget(".widgetS");
widgetS = false;
}
});
$(".pageS").on("click", function()
{
if (widgetS == true)
{
closeWidget(".widgetS");
widgetS = false;
}
if (widgetF == true)
{
closeWidget(".widgetF");
widgetF = false;
}
});
$(".pageF").on("click", function()
{
if (widgetS == true)
{
closeWidget(".widgetS");
widgetS = false;
}
if (widgetF == true)
{
closeWidget(".widgetF");
widgetF = false;
}
});
});