在jQuery移动跳过页面之后,JS文件已加载,但尚未执行。我使用$.mobile.pageContainer.pagecontainer ('change')
方法。为什么?这是跳跃目标的头部。通过这种方式,JS可以执行
<!-- mainview -->
<div name ="main" id="mainView" data-role="page">
<!-- jQuery -->
<script src="../js/public/jquery-2.1.0.min.js"></script>
<!-- jQuery Mobile -->
<script src="../js/public/jquery.mobile-1.4.5.min.js"></script>
<!-- jQuery Mobile css -->
<link rel="stylesheet" href="../css/jquery.mobile-1.4.5.min.css">
<link rel="stylesheet" type="text/css" href="../css/DIYIcon.css">
<link rel="stylesheet" type="text/css" href="../css/mainCss.css">
<link rel="stylesheet" type="text/css" href="../myPlugIn/css/style.css">
<meta http-equiv="Cache" content="no-cache">
<!-- <script type="text/javascript" data-main = '../js/call/MainView.js' src="../js/public/require.js"></script> -->
<script type="text/javascript" src="../js/public/require.js"></script>
<script type="text/javascript" src="../js/call/MainView.js"></script>
<script type="text/javascript">
require(['insert','listen','util'],function(insert,listen,util){
$(window).on('resize',util.changeFrameHeight());
listen.showDirector();
listen.showProjectManage();
listen.bottomNavigationBar();
listen.searchInsert();
listen.searchBt();
// listen.leftAndRigth();
})
但是这样,JS就不会执行了。
<!-- mainview -->
<div name ="main" id="mainView" data-role="page">
<!-- jQuery -->
<script src="../js/public/jquery-2.1.0.min.js"></script>
<!-- jQuery Mobile -->
<script src="../js/public/jquery.mobile-1.4.5.min.js"></script>
<!-- jQuery Mobile css -->
<link rel="stylesheet" href="../css/jquery.mobile-1.4.5.min.css">
<link rel="stylesheet" type="text/css" href="../css/DIYIcon.css">
<link rel="stylesheet" type="text/css" href="../css/mainCss.css">
<link rel="stylesheet" type="text/css" href="../myPlugIn/css/style.css">
<meta http-equiv="Cache" content="no-cache">
<script type="text/javascript" data-main = '../js/call/MainView.js' src="../js/public/require.js"></script>
<!-- <script type="text/javascript" src="../js/public/require.js"></script>
<script type="text/javascript" src="../js/call/MainView.js"></script> -->