Logic Machine Forum
Auto-opening widget after loading the page - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9)
+--- Thread: Auto-opening widget after loading the page (/showthread.php?tid=3540)



Auto-opening widget after loading the page - anett@poczta.fm - 02.09.2021

Hi I'm constantly trying to find a solution; automatic loading of the widget after loading the page. I found js code on the forum that uses the page id (currentPlanId) and the widget id. Unfortunately it doesn't work properly on my page:

https://forum.logicmachine.net/showthread.php?tid=195&page=2&highlight=widget+open

Maybe someone knows how to write code that automatically opens the widget after the page is loaded?


RE: Auto-opening widget after loading the page - Daniel - 03.09.2021

You should not be using widget for this only two plans and the floor plan directly on it. If you use Pietro and Parter as links with icon and active icon you will get exactly what you need.


RE: Auto-opening widget after loading the page - admin - 03.09.2021

Add this to Custom JavaScript. Add widget-autoopen class to the button that will be clicked when the plan is shown.
Code:
$(function(){
  function showWidgets() {
    $('#plan-' + currentPlanId).find('.widget-autoopen').trigger('vclick');
  }
  
  $('body').on('showplan', showWidgets);
  showWidgets();
});



RE: Auto-opening widget after loading the page - anett@poczta.fm - 03.09.2021

(03.09.2021, 07:41)Daniel Wrote: You should not be using widget for this only two plans and the floor plan directly on it. If you use Pietro and Parter as links with icon and active icon you will get exactly what you need.

Yes, you are right, Thanks!

(03.09.2021, 07:47)admin Wrote: Add this to Custom JavaScript. Add widget-autoopen class to the button that will be clicked when the plan is shown.
Code:
$(function(){
  function showWidgets() {
    $('#plan-' + currentPlanId).find('.widget-autoopen').trigger('vclick');
  }
 
  $('body').on('showplan', showWidgets);
  showWidgets();
});

Works fantastic, thank you very much!