Skip Navigation

[Resolved] Open infowindow of marker on hover using Javascript

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 0 reply, has 1 voice.

Last updated by Minesh 8 months, 1 week ago.

Assisted by: Minesh.

Author
Posts
#2783158

Tell us what you are trying to do?
We are trying to change the behavior from click to mouseover for showing the infowindow of a marker.

Is there any documentation that you are following?
Tried modifying the code in the solution here to use mouseover. It works to change the icon as shown, but we are unable to trigger the infowindow:
https://toolset.com/forums/topic/change-google-map-marker-on-click/#post-1762225

This page may be related to what we are trying to do, but is a 404 so we can't access it: https://toolset.com/forums/topic/auto-open-the-infowindow-of-marker-on-map-load/

Also, tried to utilize info found in these:
https://toolset.com/documentation/programmer-reference/maps/customizing-cluster-markers-with-javascript-functions/
https://toolset.com/documentation/programmer-reference/maps/programmatically-change-map-settings/
https://toolset.com/forums/topic/need-to-open-the-infowindow-for-all-markers/

Is there a similar example that we can see?
We are trying to achieve something like this: hidden link

What is the link to your site?
hidden link

#2783184

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Can you please share problem URL where you added the map as well as where you added the focus on marker link.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2783468

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

There is no such feature to open marker popup on mouseover on the marker itself.

However - what if you try to use the following custom JS code and check if that help you to resolve your issue.

jQuery(document).ready(function($){
 
 jQuery( document ).on( 'js_event_wpv_addon_maps_init_map_completed',function(event_settings) {

   //// here replace "map-1" with your original map ID 
    var map_id= "map-1"; 
    var markers = WPViews.view_addon_maps.markers;
    var current_map_markers = markers[map_id]; 
   
    for(var i in current_map_markers) {
      var marker = current_map_markers[i];
      
      var infowindow = new google.maps.InfoWindow();  
google.maps.event.addListener(marker, 'mouseover', (function(marker,i) {  
	
           return function() {  
      
   	     markerdata = WPViews.view_addon_maps.maps_data[0].markers;
             for(var j in markerdata){
               
              if(markerdata[j].marker==i){
                    infowindow.setContent(markerdata[j].markerinfowindow);  
                    infowindow.open(map_id, marker);
               }
             }

           }  
         })(marker,i));
      
    }
});
 
});
#2783566

That worked! That is exactly what we were trying to achieve. Thank you, Minesh.

#2783613

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Really glad to know that the solution I shared was exactly you were looking for.

I hope this serve all your need and you're welcome to mark resolve this ticket.