Google map visualization - add click event

cyberholic

Member
Good evening everyone.
I am using the google maps visualization and it shows my markers without a problem.
Now i would like to create a function that will be called whenever a marker is clicked.

I know that this can be done via the Google maps API, but i am totally unsure about what ID Fabrik creates for the map object etc.

I am trying to make a simple console.log("hello") when i click on a marker, but i don't know where to start.

Thanks in advance for your time and help!
 
I recently added a Fabrik event which fires when we've opened a marker popup. To use it, add a ./components/com_fabrik/js/viz_X.js (where X is your numeric viz ID), and do ...

Code:
requirejs('fab/fabrik', function() {
   Fabrik.addEvent('fabrik.viz.googlemap.info.opened', function(viz, marker) {
      // your code here.  viz is the Fabrik viz object, so viz.map is the Google map object, marker is the Google map marker object that was clicked
   });
});

-- hugh
 
hmm, on click on the marker it opens the bubble template...
I know, but i am searching for something like cheesegrits mentions as i do not like the standard bubble design and content possibilities. I tried to use the overlay function but for some odd reason it did not work and the console popped up with several errors. I think that this was template related. I will try out Cheesgrits suggestion.
 
Ah, well, we trigger that event after we open the bubble template, so won't be much help if you don't want that to open.

Overlays should work, although the issue you'd have would be when to create them, as we create the Google map asyncronously during load, and I don't think we currently fire an event to tell you it's created. Plus of course you won't be able to stop us adding our click events.

I think you'd be surprised at what you can do with the existing bubble templates, just with CSS and the built in content generation. We have people who even open live video feeds in nicely styled popups (a site showing drone traffic cams in France).

Perhaps if you explain in more detail what you are trying to do, I can suggest an approach.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top