从后面的代码传递参数到自我调用jQuery函数?

时间:2019-08-09 15:57:47

标签: javascript asp.net c#-4.0 google-maps-api-3

我想将标记坐标从代码传递到Google Map API,该API在现有HTML代码中使用自调用jquery函数进行调用。

带有硬编码位置数据的现有js文件。我想从后面的代码传递位置数据。

            (function ($) {
       "use strict";
        var markerIcon = {
            anchor: new google.maps.Point(12, 0),
            url: 'images/marker.png',
            labelOrigin: new google.maps.Point(25, 20)
        }
        function mainMap() {
            function locationData(locationURL, locationImg, locationTitle, locationAddress, locationPrice, locationStarRating) {
                return ('<div class="map-popup-wrap"><div class="map-popup"><div class="infoBox-close"><i class="far fa-times"></i></div><a href="' + locationURL + '" class="listing-img-content fl-wrap"><img src="' + locationImg + '" alt=""><span class="map-popup-location-price"><strong>Awg/Night</strong>' + locationPrice + '</span></a> <div class="listing-content fl-wrap"><div class="card-popup-raining map-card-rainting" data-staRrating="' + locationStarRating + '"></div><div class="listing-title fl-wrap"><h4><a href=' + locationURL + '>' + locationTitle + '</a></h4><span class="map-popup-location-info"><i class="fas fa-map-marker-alt"></i>' + locationAddress + '</span></div></div></div></div>')
            }
            //  Map Infoboxes ------------------
            var locations = [
       [locationData('listing-single2.html', 'images/gal/8.jpg', 'Premium Plaza Hotel', "1327 Intervale Ave, Bronx, NY, USA", "$ 320", "5"), 40.72956781, -73.99726866, 0, markerIcon]
            ];
    })(this.jQuery);

0 个答案:

没有答案