【问题标题】:Jquery mobile doesn't follow a link comming from another JQM pageJquery mobile 不遵循来自另一个 JQM 页面的链接
【发布时间】:2012-09-22 22:51:03
【问题描述】:

我正在使用 jquery-ui-map 插件,当我单击按钮时,我的测试页面 (test.html) 会正确加载 Google 地图。如果从另一个 jquery 移动页面加载,这个相同的 test.html 不起作用。我做错了什么或我错过了什么?接下来是重要代码:

标头中的Javascript(如基本地图的示例):

var mobileDemo = { 'center': '57.7973333,12.0502107', 'zoom': 10 };
$('#basic_map').live('pageinit', function() {
  demo.add('basic_map', function() {
    $('#map_canvas').gmap({
      'center': mobileDemo.center, 
      'zoom': mobileDemo.zoom,
      'disableDefaultUI':true,
      'callback': function() {
    var self = this;
    self.addMarker({'position': this.get('map').getCenter() }).click(function() {
      self.openInfoWindow({ 'content': 'Hello World!' }, this);
      });
    }});
  }).load('basic_map');
});

$('#basic_map').live('pageshow', function() {
  demo.add('basic_map', function() { $('#map_canvas').gmap('refresh'); }).load('basic_map');
});

还有 html(抱歉,我无法发布 HTML 代码,因为它已被解释,但链接在下面):

http://www.medlifesolutions.com.mx/locations/mobile/test.html

正如我所说,如果我直接在浏览器中编写 test.html 但如果来自另一个页面,这将非常完美:

http://www.medlifesolutions.com.mx/locations/mobile/main.php

它只是忽略“点击”或触摸按钮以显示地图。提前感谢您的帮助。

【问题讨论】:

    标签: google-maps jquery-mobile jquery-ui-map


    【解决方案1】:

    我在您的代码中看到的一个问题是live 的使用。建议将live替换为on

    【讨论】:

      猜你喜欢
      • 2018-03-11
      • 1970-01-01
      • 1970-01-01
      • 2013-01-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多