0

I want to load a map into a div but im cant make it work (map is not loading) using 1.4.3 jquery mobile version.

Everything is working under jquery mobile 1.1.0, but not with 1.4.3.

I was reading some other posts in stackoverflow forum related with new versions of jquery mobile specification, but i didnt manage to make it work.

Javascript (working with v. 1.1.0):

$(document).bind("mobileinit", function () { $.mobile.ajaxEnabled = false; });

    $(Start);

    function Start() {
        $(".ui-collapsible-heading").live("click", function () {
            var latlng = new google.maps.LatLng(39.945334, -75.168041);
            var myOptions = {zoom: 8, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP};
            var map = new google.maps.Map(document.getElementById("googleMap"), myOptions);
            google.maps.event.addListener(map, 'click', function (event) {
                marker = new google.maps.Marker({position: event.latLng, map: map});

                alert(event.latLng);
            });
        });
    }

How can i modify my code in order to accomplish the same result using Jquery Mobile 1.4.3 ?

Bugdr0id
  • 2,962
  • 6
  • 35
  • 59
  • 1
    `.live` is deprecated, use `.on`. – Omar Jul 15 '14 at 15:54
  • @Omar i tried but the same is happening. I can see the map after a refresh but not when i came from another page. – Bugdr0id Jul 15 '14 at 19:15
  • Because you need to use pagecontainer events http://jqmtricks.wordpress.com/2014/03/26/jquery-mobile-page-events/ another answer http://stackoverflow.com/questions/21997604/jquery-mobile-google-maps-showing-intermittently/22001257#22001257 – Omar Jul 15 '14 at 20:05
  • i was trying all day make it work and nothing. I already read about it, but still dont know whats wrong. The second link has a similar example but i cant make it work on my project. – Bugdr0id Jul 15 '14 at 20:26
  • Can you create a js fiddle? – Omar Jul 15 '14 at 20:42
  • @Omar http://jsfiddle.net/xpto_dc/kt8Zf/ – Bugdr0id Jul 15 '14 at 21:05
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/57351/discussion-between-omar-and-user1907954). – Omar Jul 15 '14 at 21:12

0 Answers0