jquery mobile和jquery ui不兼容

jquery mobile and jquery ui not compatitble

本文关键字:jquery 不兼容 ui mobile      更新时间:2023-09-26

am正在开发一个可以在两个桌面上工作的html5应用程序,平板电脑和移动设备在使用进度条和对话框时陷入了困境。起初我一直在使用jquery-mobile,但直到现在,我才意识到两者结合使用效果不佳。这是两个插件效果的示例代码

<!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时,上面的代码运行得很好。但我真的需要在我完整的应用程序中使用它。如果能帮助我如何使用这两个,我们将不胜感激。我见过很多类似的问题,但农解决了我的问题提前谢谢。

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