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.

Auto opening widget, Changing camera view in 1 small widget
#21
(12.09.2016, 15:32)Erwin van der Zwart Wrote: Hi Buuuudzik,

Try this:


Code:
$(function(){
 
 var openwidget = false;
 
 function openWidget(){  
 if (currentPlanId == 4){
     if (openwidget == false){
         openwidget = true;  
        // Open widget
     $("#widget-5").removeClass("hide");
         // Position widget (absolute positioned)
     document.getElementById("widget-5").style.top = "150px";
     document.getElementById("widget-5").style.left = "150px";
     document.getElementById("widget-5").style.width = "1024px";
     document.getElementById("widget-5").style.height = "600px";
     }
 } else {
     // Condition to hide widget
     $("#widget-5").addClass("hide");
     openwidget = false;
   }
 }

 // Initial execution if needed
 openWidget();

 // Add event listener to control elements only for checking on each user input
 $('.item-control').on( "click", function() {
     openWidget();
 });
 
});

BR,

Erwin van der Zwart


I found a solution for an opening a widget via js which works as manually opened:
Code:
$("#widget-58").css('display', 'block')

And this is for closing:
Code:
$("#widget-58").css('display', "none")
But maybe somebody knows how can I prepare the event of changing currentPlanId for triggering the function? I think this event could be very useful for everyoneWink
Reply


Messages In This Thread
RE: Auto opening widget, Changing camera view in 1 small widget - by buuuudzik - 24.01.2017, 22:15

Forum Jump: