infowindws 上的自定义按钮(如模态 Bootstrap 按钮)

Custom button on infowindws (like modal Bootstrap button)

我有一个应用程序,在信息 window 中出现一个按钮 "More Info",可以打开模态视图。代码是:

(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);

我的问题是关于按钮的样式。如何添加具有模态 bootstrap 按钮样式的按钮(即 btn-primary class 按钮)?

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

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

我在 infowindows 上找到了引导按钮。您可以将 btn-info 更改为另一个 class.

希望对您有所帮助。