This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Button of widget doesn't change immage
#3
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:
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;
   }
 });
});
Reply


Messages In This Thread
RE: Button of widget doesn't change immage - by Mirco - 27.10.2016, 08:38

Forum Jump: