【问题标题】:Custom button on infowindws (like modal Bootstrap button)infowindws 上的自定义按钮(如模式引导按钮)
【发布时间】:2015-12-25 01:27:32
【问题描述】:

我有一个应用程序,在信息窗口中,会出现一个“更多信息”按钮,用于打开模式视图。代码是:

(function(marker, data) {// Attaching a click event to the current marker
     google.maps.event.addListener(marker, "click", function() {
         geocoder.geocode({'latLng': marker.position}, function(results, status) {
           if(status == google.maps.GeocoderStatus.OK) {
              if (results[0]) { //defino la direccion
                 address = results[0].formatted_address;
                 info = '<h4>' + marker.title + '</h4><h4>'+ address+'</h4>';
                 var content = document.createElement('div'),button;
                 content.innerHTML = info + '<br/>';
                 button = content.appendChild(document.createElement('input'));
                 button.type = 'button';
                 button.value = 'More info';
                     google.maps.event.addDomListener(button, 'click', function () {
                        offsetCenter(marker,data);
                      })
                  infoWindow.setContent(content);

我的问题是关于按钮的样式。如何添加样式类似于模式引导按钮(即 btn-primary 类按钮)的按钮?

【问题讨论】:

    标签: javascript bootstrap-modal infowindow


    【解决方案1】:

    我找到了使用 setAttribute 属性的简单解决方案。 只是使用:

     button.setAttribute('class', 'btn btn-info');
    

    我在 infowindows 上获得了 bootsrap 按钮。您可以将 btn-info 更改为其他课程。

    希望对你有帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多