2012-11-06 79 views
2

我正在爲iPad的HTML5開發一個應用程序。fancybox在ipad應用程序

我加入了元標記:

<meta name="apple-mobile-web-app-capable" content="yes" /> 

不過的fancybox不行,因爲這在自窗口(黑色窗口)打開。

的的fancybox代碼:

jQuery.noConflict(); 
var $js = jQuery; 

$js(document).ready(function() { 

    $js(".modalwin").fancybox({ 
     width: 980, 
     height: 600, 
     maxWidth: 980, 
     maxHeight: 600, 
     fitToView: false, 
     autoSize: false, 
     closeClick: false, 
     openEffect: 'fade', 
     closeEffect: 'fade', 
     type: 'iframe', 
     margin: 0, 
     padding: 5, 
     openSpeed: 'fast', 
     closeSpeed: 'fast', 
     scrolling: 'no', 
     helpers: { 
      title: { 
       type: 'outside' 
      }, 
      overlay: { 
       css: { 
        'background': 'rgba(0,0,0,0.9)' 
       } 
      } 
     }, 
     beforeShow: function() { 
      $js(".fancybox-skin").css("backgroundColor", "#D84B04"); 
     } 
    }) 
}); 

,並防止我用一個空白頁以外的應用程序中打開鏈接:

jQuery.noConflict(); 
var $jx = jQuery; 

$jx(document).on("click", "a", function(event) { 
    event.preventDefault(); 
    location.href = $jx(event.target).attr("href"); 
});​ 

請幫我解決這個問題。

+0

什麼是你想實現與第二個腳本'$ JX(文件)。在(「點擊」'你試過沒有它...有一個鏈接? – JFK

回答

0

我創立了?答:

jQuery.noConflict(); 
    var $jx = jQuery; 

    $jx(document).delegate("a:not(.modalwin)", "click", function(event){ 
    window.location=this.getAttribute("href"); 
    return false; 
    }); 
+0

在這種情況下'$ jx(document).on(「click」,「a:not(.modalwin)」,...'會做得更好(儘管需要jQuery 1.7+) – JFK