2012-12-04 77 views
0

使用JQueryMobile 1.2.0的Im。JQuery Mobile Popup未顯示

我想以編程方式顯示彈出,所以我有以下幾點:

$('#btn').on('click',function(){ 
    alert('this is ok'); 
    $('#popupBasic').popup(); 

}); 

在JQM頁面:

<div data-role="popup" id="popupBasic"> 
    <p>This is a completely basic popup, no options set.<p> 
</div> 

但彈出沒有露面。任何解決這個問題?由於

回答

2

打開在jQueryMobile彈出窗口要求你要麼

  1. 調用open$('#popupBasic').popup("open");
  2. 只需瀏覽到它與超鏈接,如<a href="#popupBasic" data-rel="popup" data-transition="slidedown" >Slide down the popup</a>
2

下面是一個工作示例: http://jsfiddle.net/Gajotres/YMXgv/

<a href="#" data-transition="none" data-role="button" data-inline="true" data-rel="popup" id="testButton">Popup example</a> 


$('#testButton').bind('click', function(e) { 
    $("#popupBasic").popup("open") 
});