2012-08-31 40 views
0

我有这个小片段在jquery 1.7.1,jqm 1.1.0和jquery-ui-maps v3上运行。jquery-ui-map框架在jqm 1.1.1上无法正常工作?

从jqm1.1.0切换到1.1.1时,有没有人遇到过任何问题? 我曾在一个JQM应用程序实例这些代码,它是在更新前的工作:

function loadGMaps() { 
$(document).live('pageinit', function() { 
    $('#main-map').gmap({'disableDefaultUI':true, 'callback': function(map) {   
     var self = this;    
     self.watchPosition(function(position, status) { 
      if (status === 'OK') { 
       var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude); 
       if (!self.get('markers').client) { 
        self.addMarker({ 'id': 'client', 'position': latlng, 'bounds': true }); 
       } else { 
        self.get('markers').client.setPosition(latlng); 
        map.panTo(latlng); 
       } 
       /*self.search({ 'address': 'Vancouver, Canada' }, function(results, status) {    
        if (status === 'OK') { 
         console.log(results[0]); 
         } 
        });*/ 
      } 
     });   
    }}); 
}); 

$(document).live('pageshow', function() { 
    $('#main-map').gmap('refresh') 
}); 

$(document).live('pagehide', function() { 
    $('#main-map').gmap('clearWatch') 
}); 
} 

使用FF调试,这似乎不是召self.watchPosition()命令,只是跳过它。

代码是从这里取 http://jquery-ui-map.googlecode.com/svn/trunk/demos/jquery-google-maps-mobile.html#gps_map

可能有人给我一个忠告那里? 谢谢!

编辑:我使用的HTML代码非常相似,一个在例如:

<div id='intro' data-role='content'> 
    <div class='row'> 
    <div class='twelvecol last'> 
     <div class='cell'> 
     <div id='main-map' style='height:300px;' class='align-center'> 
      <h5> 
      <span>Map</span> 
      </h5>   
     </div> 
     </div> 
    </div>  
    </div> 
</div> 
+0

我们需要一些html来重现问题 – ShaunOReilly

+0

HTML已被添加 – Dieghito

+0

如果你可以在http://jsfiddle.net/webwarrior/bqFtg/1/填写缺失的位然后我会告诉你如何追踪这个问题 – ShaunOReilly

回答