开发者

Click on a marker to redirect user to a blog post

开发者 https://www.devze.com 2023-01-02 09:00 出处:网络
I\'m using the following Wordpress and plugins combo. Wordpress 2.9.2 Geo Mashup 1.3.3 Geo Mashup Custom 1.0

I'm using the following Wordpress and plugins combo.

  • Wordpress 2.9.2
  • Geo Mashup 1.3.3
  • Geo Mashup Custom 1.0

What I want to achieve is when the user clicks on a marker it gets redirected to the blog post associated to it.

I added the following code in my custom.js.

GeoMashup.addAction('loadedMap', function( properties, marker ) {
    GEvent.addListener(marker, "click", function() {
        parent.location.href = properties.home_url + "?p=" + properties开发者_如何转开发.open_object_id ;
    });
});

With that code the map loads and redirects to the latest marker created on the map. I'm pretty sure I'm close to the final solution.

I guess i'm using the wrong action call. But I haven't been able to find what i'm looking for.

Any suggestions?


My solution for Geo Mashup 1.3.3 makes some assumptions that might possibly change in the future, but are necessary for now:

GeoMashup.addAction( 'selectedMarker', function( properties, marker ) { 
  var loc = GeoMashup.locations[ marker.getPoint() ]; 
  if ( loc && loc.objects.length > 0 ) { 
    parent.location.href = properties.home_url + '?p=' + loc.objects[0].object_id; 
  } 
} ); 
0

精彩评论

暂无评论...
验证码 换一张
取 消