2013-08-07 70 views
0

我正在研究可以在桌面,平板电脑和移动设备上运行的html5应用程序.am在使用进度条和对话框时遇到了困难。首先,我一直使用jquery mobile,但是它的唯一直到现在,当我想要结合jQuery UI使用进度条和对话框弹出窗口时,我才意识到两者一起使用时效果不佳。这两个插件jquery mobile和jquery ui不兼容

<!doctype html> 
<html lang="en"> 
<head> 
<meta charset="utf-8"> 
<title>dialogbox demo</title> 
    <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" /> 
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" /> 
    <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script> 
    <script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script> 
    <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script> 

</head> 
<body>   
<script> 
    $(document).ready(function() { 
     $().lowStorageSpace(); 
    }); 

     $.fn.lowStorageSpace = function() { 
      $('<div></div>').appendTo('body') 
      .html('<div><h5>You are running out of space.backup or sync data before you proceed!!</h5></div>') 
      .dialog({ 
       modal: true, title: 'Low storage space!!', zIndex: 10000, autoOpen: true, 
       width: 'auto', resizable: true, 
       buttons: { 
        Sync: function() { 
         //sync(); 
         $(this).dialog("close"); 
        }, 
        Backup: function() { 
         // backup(); 
         $(this).dialog("close"); 
        }, 
        Cancel: function() { 
         //cancel(); 
         $(this).dialog("close"); 
        } 
       }, 
       close: function (event, ui) { 
        $(this).remove(); 
       } 
      }); 

     } 

</script> 
</body> 
</html> 

的上面的代码效果很好,当我注释掉jquery.mobile-1.2.0.min.js效果的示例代码。但我真的需要它在我的完整的应用程序。 任何帮助我如何使用这两个将不胜感激。 我已经看到很多类似的问题,但非提前在此感谢我解决了我的问题 。

回答

0

这是我同意的冲突。在jquery ui和jquery mobile的所有例子中,我已经看到我没有看到代码显示这两个可以在同一个脚本上使用。我会用两个不同的脚本,一个用于UI,一个用于手机。这样,这里不应该有任何冲突。

+0

@John ...在我的情况下,使用不同的脚本不会工作,因为我正在一个html页面上工作,其中有几个页面。 – JoseLuke