【问题标题】:jQuery load external files into static popup dynamicallyjQuery 将外部文件动态加载到静态弹出窗口中
【发布时间】:2013-06-06 09:25:41
【问题描述】:

我在打开一个弹出窗口并加载外部文件时遇到了麻烦。前两次效果很好。第三次出现“找不到文件”错误,即使该文件可用。 (这是一个移动 WebApp,我在 Safari / jQueryMobile 上试用)。

我的代码来了:

$(document).on("pageinit", '#pageContainer', function() {
 $.mobile.allowCrossDomainPages = true;
     $("a", "#list").click(function (event, ui) {
      var attr = $(this).attr('id');
  var name = attr.replace ('linkID','');
      $("#singleSwipe_popup").load('dynamic/' + name + '.html', function() {
   $(".singlePopup" ).on({
        popupbeforeposition: function() {
    // init Swipe-Slider ... on global var singleSwipeSlider ... Works ...
    }, popupafterclose: function() {
     delete singleSwipeSlider;  // destroy the swipe slider
     $('#singleSwipe_popup').empty();  // clean popup content
       }
   });
  });
 });
});

HTML:

<div id="prodPopupsConainter">
 <div data-role="popup" class="singlePopup ui-corner-none" id="popupSingle" data-overlay-theme="b">
 <a href="#" data-rel="back" data-role="button" data-theme="a" data-icon="delete"     data-iconpos="notext" class="ui-btn-left">Close</a>
 <div id="singleswipe-left" class="swipe-left"></div>
 <div class="wrapAndFloat" id="singleSwipe_popup">
 <!-- POPUP content comes here -->
</div>
 <div id="singleswipe-right" class="swipe-right"></div>
</div>          
</div>

.... 如果没有弹出窗口的 html 代码和“$("#prodPopupsConainter").load ...”,动态加载效果很好。

谁能给我一个解决方案?

【问题讨论】:

    标签: jquery jquery-mobile popup load external


    【解决方案1】:

    通过将 jQuery 1.9.1、jQueryMobile 1.3.1 和 Phonegap 更新到 2.8.0 版本解决了问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-12-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多