Skip Navigation

[Resolved] JS in View not executing

This support ticket is created 3 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 6 replies, has 2 voices.

Last updated by Luo Yang 3 years, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#2072015
Toolset 4.png

I inserted the following JS per your ticket #1155174jQuery(document).on('js_event_wpv_addon_maps_init_map_completed', function() {

// Get the map using our .get_map() method
var map = WPViews.view_addon_maps.get_map( event_settings.map_id );
// Use Maps API .setOptions() method to programmatically change any option on the map.
if ( map ) {
map.setOptions({
gestureHandling: 'none',
'maxZoom': 4,
});
}
});
It does not appear to be executing, is there something I must do to prepare for it?
My Map ID is map-8
Thankyou

#2072193

Hello,

Since it is a custom JS codes problem, please provide a test site with the same problem, also point out the problem page URLs, I need to test and debug it in a live website, private message box enabled, thanks

#2073243

Thanks for the details, I have done below modifications in your website, change this line of your custom JS codes from:
var map = WPViews.view_addon_maps.get_map( event_settings.map_id );

To:
var map = WPViews.view_addon_maps.get_map( 'map-8' );

The "map-8" is your map ID

Please test again, check if it is fixed, thanks

#2073883

Thanks for your most excellent and timely support

The change is in:
var map = WPViews.view_addon_maps.get_map( 'map-8' );
I tried various values for the zoom, 'maxZoom': 4, -- but no effect

BTW, just so I know, under what circumstances would I have used the original code
var map = WPViews.view_addon_maps.get_map( event_settings.map_id );

Thanks again, I highly appreciate the work you do

#2073913

Update: seems to work now since changing to the default theme and updating Toolset plugins to the very latest

#2074253

I have tried again in your website:
1) Switch to theme "Astra" or "Newspaper"
2) Test it in front-end:
hidden link

Both tests work fine, is this problem resolved?
Please let me know if you still need assistance for it, thanks

#2074371

For the new question:
under what circumstances would I have used the original code

The original custom JS code is outdated, you need to customize it according to your map IDs.