문제

Im trying to embed a map sing google maps api v3 in my nyromodal box but it doesnt happen.

I've tested the code without the modal and it works but when i try to open it on the nyromodal nothing appears.

How can i do it?

도움이 되었습니까?

해결책

Ive just figured out how to do it!

1 - Insert the js code for google in your index page with 'rel="forceload"' and 'rev="shown"' as the following:

<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&sensor=false" rel="forceload" rev="shown"></script>

2 - You insert the code that generates the map inside the modal page as the following:

<script>
    $(document).ready({
        var mylatlng = new google.maps.LatLng(latitude, longitude);
        var mapProp = {
            center: mylatlng,
            zoom: 15,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        var map = new google.maps.Map(document.getElementById("briefmap"), mapProp);
        var marker = new google.maps.Marker({
            position: mylatlng
        });
    });
</script>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top