Catch Mobile Sidebar Open/Close Event

Catch Mobile Sidebar Open/Close Event

  

Hi all

Recently we came upon a situation where we had to catch the opening and closing events of the mobile SilkUI sidebar. The sidebar includes a variable that controls that event if you had to open/close at the press of a button for example.

However, if the sidebar is open or closed by sliding left/right, that variable is not updated, nor does the sidebar expose an event where you could catch that and run some code. 


Inspecting the sidebar, we did notice that there is a container that gets a sidebar-open class when it is open and loses it upon closing it regardless of method. However the Id of the div is dynamic and impossible to get in run-time. 


Can you guys think of a method to catch this opening/closing of the sidebar? Maybe some jQuery? Any ideas?


Regards,

   CLSJ

Hi Carlos,

My mobile knowledge is not much but if you use something like this document.getElementById(<widgetid>).addEventListener('touchend', <function>, false); it should work. the widget should be the container of the menu.

Regards,

Marcelo

Hello Carlos,

This is a know bug of this widget and, afaik, there is no workaround possible at this time.

You can try contacting OutSystems to see if they have a solution.

Cheers.

Hi Marcelo and Eduardo

Thank you for your responses. It is indeed a known bug. Adding the event listener manually on the onRender did not work, however adding it on the container onTouchStart via the container properties did. The only problem to this is that the action is fired upon touching the sidebar (as it should) not only upon opening and closing. This is a partial workaround so I'll leave it unsolved, in case anyone comes up with something better.


Regards!

   CLSJ