简体   繁体   English

添加指向 Google 地图信息的超链接。 窗户

[英]Adding a hyperlink to a Google Maps info. window

I'm creating a Google Map with multiple markers.我正在创建一个带有多个标记的谷歌地图。 Each marker shows an info.每个标记显示一个信息。 window when clicked upon.单击时的窗口。 I need to figure out how to add a hyperlink to the info.我需要弄清楚如何向信息添加超链接。 window through the Javascript.窗口通过Javascript。

Here is an example of the Javascript that determines what text will be displayed inside the info.下面是一个 Javascript 示例,它确定将在信息中显示哪些文本。 window:窗户:

"infoWindows": [{
            "id": 4980,
            "marker_id": "latitude and longitude here",
            "title": "title here",
            "subtitle": "subtitle here",
            "phone": "phone here",
            "address": "address here",
            "email": "email here",
            "web": "web here",
            "content": "content here",
            "open": 0
        }

Here is the Javascript that allows this information to be displayed when clicking on a marker:这是允许在单击标记时显示此信息的 Javascript:

b.settings.infoWindows[j].title.length > 0 && (l += '<div class="uber-google-maps-info-window-field uber-google-maps-title">' + b.settings.infoWindows[j].title + "</div>"), 

b.settings.infoWindows[j].subtitle.length > 0 && (l += '<div class="uber-google-maps-info-window-field uber-google-maps-subtitle">' + b.settings.infoWindows[j].subtitle + "</div>"),  

b.settings.infoWindows[j].phone.length > 0 && (l += '<div class="uber-google-maps-info-window-field">' + b.settings.infoWindows[j].phone + "</div>"),  

b.settings.infoWindows[j].email.length > 0 && (l += '<div class="uber-google-maps-info-window-field">' + b.settings.infoWindows[j].email + "</div>"), 

b.settings.infoWindows[j].address.length > 0 && (l += '<div class="uber-google-maps-info-window-field">' + b.settings.infoWindows[j].address + "</div>"), 

b.settings.infoWindows[j].web.length > 0 && (l += '<div class="uber-google-maps-info-window-field uber-google-maps-web">' + b.settings.infoWindows[j].web + "</div>"), 

b.settings.infoWindows[j].content.length > 0 && (l += b.settings.infoWindows[j].content), l += "</div>";

How would I add a hyperlink to this info.我将如何向此信息添加超链接。 bubble?气泡? I am unsure how hyperlinks are formatted in Javascript.我不确定超链接是如何在 Javascript 中格式化的。 Preferably I would like to add the hyperlink to the "web" portion of the info.最好我想将超链接添加到信息的“网络”部分。 window.窗户。 Help much appreciated!非常感谢帮助!

Assuming you're looking to add the email as the hyperlink...假设您希望将电子邮件添加为超链接...

'<div class="uber-google-maps-info-window-field"><a href="mailto:' + b.settings.infoWindows[j].email + '">' + b.settings.infoWindows[j].email + '</a></div>'

or for some other hyperlink或其他一些超链接

'<div class="uber-google-maps-info-window-field"><a href="' + b.settings.infoWindows[j].someHyperlink + '">' + b.settings.infoWindows[j].someHyperlink + '</a></div>'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM