Plugin Directory

Changeset 2384677


Ignore:
Timestamp:
09/18/2020 07:58:33 PM (5 years ago)
Author:
intelchip
Message:

Bugfix to markers tooltip not showing buttons if content is not added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • osm-map-elementor/trunk/osm-map.php

    r2384642 r2384677  
    817817
    818818                    // prep tooltip content
    819                     let tooltipContent = null;
    820                     if (this.marker.marker_title && !this.marker.marker_description) {
    821                         tooltipContent = `<div class="marker-tooltip"><div class="marker-title">${this.marker.marker_title}</div></div>`;
    822                     } else if (this.marker.marker_description && this.marker.show_button !== 'yes') {
    823                         tooltipContent = `<div class="marker-tooltip"><div class="marker-title">${this.marker.marker_title}</div><div class="marker-content"><div class="marker-description">${this.marker.marker_description}</div></div></div>`;
    824                     } else if (this.marker.show_button === 'yes' && !this.marker.marker_description) {
    825                         tooltipContent = `<div class="marker-tooltip"><div class="marker-title">${this.marker.marker_title}</div><div class="marker-content"><div class="marker-button"><a class="elementor-button" target="_blank" href='${this.marker.button_url}'>${this.marker.button_text}</a></div></div></div>`;
    826                     } else if (this.marker.show_button === 'yes') {
    827                         tooltipContent = `<div class="marker-tooltip"><div class="marker-title">${this.marker.marker_title}</div><div class="marker-content"><div class="marker-description">${this.marker.marker_description}</div><div class="marker-button"><a class="elementor-button" target="_blank" href='${this.marker.button_url}'>${this.marker.button_text}</a></div></div></div>`;
     819                    let tooltipContent = '<div class="marker-tooltip">';
     820
     821                    // add marker title
     822                    if (this.marker.marker_title) {
     823                        tooltipContent += `<div class="marker-title">${this.marker.marker_title}</div>`;
    828824                    }
    829825
     826                    // marker content
     827                    tooltipContent += '<div class="marker-content">';
     828
     829                    // add marker description
     830                    if (this.marker.marker_description) {
     831                        tooltipContent += `<div class="marker-description">${this.marker.marker_description}</div>`;
     832                    }
     833
     834                    // add marker button
     835                    if (this.marker.show_button === 'yes' && this.marker.button_text) {
     836                        tooltipContent += `<div class="marker-button"><a class="elementor-button" target="_blank" href='${this.marker.button_url}'>${this.marker.button_text}</a></div>`;
     837                    }
     838
     839                    tooltipContent += '</div>';
     840                    tooltipContent += '</div>';
     841
    830842                    // add tooltip to marker
    831                     if (tooltipContent) {
     843                    if (this.marker.marker_title || this.marker.marker_description || this.marker.button_text && this.marker.show_button) {
    832844                        marker.bindPopup(tooltipContent);
    833845                    }
Note: See TracChangeset for help on using the changeset viewer.