I'm creating a directory with a gmap views and a list of name in the attachment. What I wanted is to hightlight the marker on the gmap views when you pass over the name.
Step 1 : Create a page view with all the filter you want
Step 2: Create the attach view to the page created.
Add the following script inside a javascript file and load it with the drupal_add_js() function or put it inside the page.tpl.php.
Drupal.behaviors.gmap = function (context) {
$('a.MyOwnLink').each(function(i){
$(this).bind('mouseover', function(){
GEvent.trigger(Drupal.settings.gmap.auto1map.markers[i].marker, "mouseover");
return false;
});
$(this).bind('mouseout', function(){
GEvent.trigger(Drupal.settings.gmap.auto1map.markers[i].marker, "mouseout");
return false;
});
});
}
a.MyOwnLink -> class name of the link use for the script
gmap.auto1map.markers -> name of my gmap map, use firebug to verify the name of yours, can be different.
Maybe this is not perfect but I haven't found something for helping me, so if it's can be usefull to someone. And sorry for my bad english.
| Comment | File | Size | Author |
|---|---|---|---|
| final.jpg | 633.2 KB | kiero63 | |
| attachment_views.jpg | 254.41 KB | kiero63 | |
| page_views.jpg | 218.66 KB | kiero63 |
Comments
Comment #1
theodorosploumisHere is an equivalent for Drupal 7 with an extra option to click the marker by clicking the .views-row div.
Comment #2
sridarm commentedCan anyone suggest how to use the same coding for openlayers module. ?
Comment #3
podarokits normal, yeh
and this should be rerolled against latest dev
Comment #4
costas vassilakis commentedHi Theodore
I am trying to use this script but I am resiving a JS Error: Uncaught ReferenceError: GEvent is not defined.
Comment #5
theodorosploumis@Costas_Vassilakis We cannot provide any help since we need access to the codes. It can be anything depending on Gmap version, module version etc.
Comment #6
tostinni commentedHere is the updated code for Google maps v3
Comment #7
harsh111 commented@tostinni thanx for the above code it helped me a lot thank so much
Comment #8
jos_s commented@tostinni This was exactly what I was looking for. Thanks for posting it here.
Comment #9
tostinni commentedYou're welcome.
Regarding the mouseover/mouseout, I don't use this part so I'm not sure how to implement the icon switch, if you have some additional informations, please share it ;).
Comment #10
jos_s commentedI don't use the mouseover/mouseout either. I tried it, but it didn't work in my setup. As I do not need it, I did not look into this any further.
If by "icon switch" you mean that the map marker changes, I cannot help you now. If I ever find out, I will share it.
Comment #11
Goekmen commentedThis helped me a lot especially #6!
I also wanted reverse the action: Click the marker and then for example give the views row a css class.
Sync both ways. Has someone an idea how to do it?
Comment #12
visabhishek commentedThanks @tostinni. Its very helpful for me.
Anyone have any idea to Sync both ?