Archived topic
hook script slideout menu
6 replies · Started by Basello on May 12, 2020
Hello,
I am tring to hook some shortcode inside the slideout menu
shortcode from a plugin (VISITOR STATISTIC PRO how use geolocation and leaflet javascript library)
If it is hooked in "before_main_content" (using Elements hook) for exemple there is no problem.
But if it is hooked in the slideout menu, something is wrong, I guess the javascript do not load.
I have the same issue with some script, for exemple a geolocation script from revolvermap:
<script type="text/javascript" src="//rf.revolvermaps.com/0/0/8.js?i=5hkgw0s45gr&m=0&c=ff0000&cr1=ffffff&f=arial&l=33" async="async"></script>
Is it a problem related to the theme?
Is it possible something in the slideout menu prevent javascript from loading?
Do I have to set something differently?
Thank you for your help.
Hi there,
what happens if you add the shortcode via the Off Canvas Widget area ?
Hi,
Thank you for your answer.
If I insert the shortcode via the Off Canvas Widget area it doesn't work either.
I just add it if you want to see.
also I notice that as soon as I launch the javascript console from google chrome : the shortcode suddenly loads and works ...
It is like something prevent the script to load and it is unlocked with the google javascript console.
It happens the same way if the shortcode is add in the widget panel or hooked.
Hi there,
It sounds like the script isn't executing while it's in a hidden div.
I wonder if there's a way we can kick-start once the panel opens? The devs of the script would know.
Let me know :)
Hi,
Thank you for your help.
I contacted the developers of the map plugin and did some test...
In fact the problem is probably due to a "responsive" functionality.
When you open the off panel menu, the card remains gray: that's the problem. Just shorten the browser window for it to appear. Or on a smartphone, simply tilt the smartphone vertically or horizontally for the map to appear.
In the previous post I said that as soon as the browser javascript console opens, the map appears: in fact it is just the fact that showing the console in the browser changes the size of the window and brings up the map.
So, I think I have to find a way to reload the contents of the off panel menu once opened, make sure to force the resizing process...
That could just mean they have code to re-initialize their script if the browser resizes. If that's the case, there should be a way to initialize it when the panel opens.