خرید بک لینک

Vote count: 0

I am using google maps V3 which working well on computer - but on mobile phone the marker cluster is not working correctly

issues are

on page load the map displays OK and shows clusters - i then click and its split the icons correctly - if i then click

again on cluster to split again - the cluster and icons disappear.

If there are only 2 icons below cluster it works OK but in most cases there are not.....

Also a window pops up on clicking ICON but its not formatted correctly -- is this

something to do with Onclick Javascript code.?

Is there a way to make sure google maps with cluster works OK on all smaller devices

or perhaps my code below is not correct? I am getting address/ lat/lng from database table

  

     <script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>


<script type="text/javascript" src="http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclustererplus/2.0.12/src/markerclusterer_packed.js">  </script>









    <script type="text/javascript">




        function initialize() {
            var markers = JSON.parse('<%=ConvertDataTabletoString() %>');
            var mapOptions = {
                center: new google.maps.LatLng(markers[0].lat, markers[0].lng),
                zoom: 5,
                maxZoom: 12,

                mapTypeId: google.maps.MapTypeId.ROADMAP
                //  marker:true
            };


            var infoWindow = new google.maps.InfoWindow();


            var latlngbounds = new google.maps.LatLngBounds();
            var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);



            var gmarkers = [];


            for (var i = 0; i < markers.length; i++) {
                var data = markers[i]
                var myLatlng = new google.maps.LatLng(data.lat, data.lng);
                var marker = new google.maps.Marker({
                    position: myLatlng,
                    map: map,
                    title: data.City,
                    url: data.Url,
                    optimized: false
                });


                marker.content = '<div class="info_content">' +


             '<img width="100" src="' + data.ImagePath + '"/>'
         + "<br>" +

    "<h3>" + '</h3>' + "<h3>" + "<b>" + data.StageName + "</b>" + '</h3>' +
"<a href='" + data.Url + "' >View Listing</a>" + '</div>';









                gmarkers.push(marker);


                (function (marker, data) {
                    google.maps.event.addListener(marker, "click", function (e) {
                        window.location = marker.url;
                    });
                })(marker, data);
                latlngbounds.extend(marker.position);






                (function (marker, data) {

                    // Attaching a click event to the current marker
                    google.maps.event.addListener(marker, "mouseover", function (e) {
                        infoWindow.setContent(marker.content);
                        infoWindow.open(map, this);
                    });
                })(marker, data);




            }






            var bounds = new google.maps.LatLngBounds();
            map.setCenter(latlngbounds.getCenter());
            map.fitBounds(latlngbounds);



            var mcoptions = { zoomOnClick: true, showText: true, averageCenter: true, maxZoom: 10 }

            var markerCluster = new MarkerClusterer(map, gmarkers, mcoptions);





        }


        google.maps.event.addDomListener(window, 'load', initialize);


    </script>









    <style type="text/css">
     .map_container{
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* Ratio 16:9 ( 100%/16*9 = 56.25% ) */
}
.map_container .map_canvas{
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    margin: 0;
    padding: 0;
asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 24 فروردين 1395 ساعت: 6:49

صفحه بندی