【问题标题】:Foursquare save button in google maps marker?谷歌地图标记中的Foursquare保存按钮?
【发布时间】:2012-01-25 14:35:01
【问题描述】:

这个想法是将列表中的所有 Foursquare 位置加载到 Google 地图中,并允许其他人通过单击“保存到foursquare 按钮”将它们添加到自己的列表中。但是当我尝试在谷歌地图标记中使用它们时遇到了一些问题。

您在 Foursquare (https://foursquare.com/business/brands/offerings/savetofoursquare) 中使用的脚本在放置在 Google 地图标记内时似乎找不到“保存到foursquare 按钮”链接,它没有样式。当您单击链接时,它不会在灯箱中打开,而是在新页面中打开。我可以用一些 CSS 设置按钮的样式。但是灯箱是另一回事,我可以打开一个,但你怎么知道什么时候关闭呢?

如果我在没有 Google 地图的情况下在单个页面上测试“保存到方形按钮”,则灯箱会在保存位置后自动关闭。但我认为如果您从标记打开一个,我认为没有办法检测何时再次关闭它

但如果脚本首先检测到“保存到方形按钮”当然更好。有没有人尝试过让“保存到方形按钮”在谷歌地图标记中工作?欢迎所有提示:)

您可以在这里看到我的意思http://tijmensmit.com/foursquare/ 按钮没有样式,也没有灯箱。

【问题讨论】:

    标签: javascript foursquare


    【解决方案1】:

    我遇到了同样的问题。

    包括 https://foursquare.com/business/brands/offerings/savetofoursquare 上的 Foursquare SDK

    取消缩小 Foursquare 的 widget.js 以了解它在 DOM 就绪时的真正作用。 这是 Foursquare 的实际作用:

    go: function (a) {
        a = g.findMarkers(a);
        e.each(a, function (a) {
            var c = g.markerConfig(a),
            b = g.instance(c);
            "false" == c.replaceButton ? b.attach(a) : b.replace(a)
        })
    },
    

    编写你自己的函数:

    // My function to replace "new" Foursquare save buttons
    // @param e : <a class=fourSq-widget> element
    function myFoursquareReplaceSave(e) {
        if (typeof e != "undefined") {
            var f = window.fourSq.widget.Factory;
            var c = f.markerConfig(e);
            var b = f.instance(c);
            "false" == c.replaceButton ? b.attach(e) : b.replace(e);
        }
    }
    

    每次创建新的 GMap Infobox 时最后调用该函数。 类似的东西:

    // t is the Infobox (a google.maps.OverlayView),
    // div is the <div> element (the content)
    // (using jquery)
    myFoursquareReplaceSave($(t.div).find('.fourSq-widget').get(0));
    

    我还没有测试过 infowindows 的 domready 监听器: https://stackoverflow.com/a/5505179/229088

    【讨论】:

      猜你喜欢
      • 2018-05-26
      • 2014-03-22
      • 1970-01-01
      • 2018-05-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多