简体   繁体   English

当我回到初始页面时,按钮不起作用

[英]Button doesn't work when I'm back on starter page

I want to implement Navigation Drawer by using panel with list of buttons (each openning other page). 我想通过使用带有按钮列表的面板(每个打开其他页面)来实现导航抽屉。 Problem occurs when I go back to the previous page and I try to open panel again. 当我返回上一页并尝试再次打开面板时,会出现问题。 Button which is supposed to do that doesn't work, it only lights up in blue. 应该执行此操作的按钮不起作用,它仅以蓝色点亮。

Start http://imgur.com/WeNactN 开始http://imgur.com/WeNactN

Open panel http://imgur.com/492rnXN 打开面板http://imgur.com/492rnXN

Back in first page, button does not work http://imgur.com/UnX7Jk4 返回首页,该按钮不起作用http://imgur.com/UnX7Jk4

Here's my index.html 这是我的index.html

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
        <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
        <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>

</head>

<body>

    <div data-role="page" id="firstPage">
      <div data-role="panel" id="myPanel" data-display="overlay"> 
        <h2>Menu</h2>
        <br/>
        <ul data-role="listview">
              <li><a href="#firstPage" data-rel="close" >First Page</a></li>
              <li><a href="#secondPage" data-rel="close" >Second Page</a></li>
        </ul>       
      </div> 

      <div data-role="header">
        <h1>First Page</h1>
        <a href="#myPanel" class="ui-btn ui-icon-bars ui-btn-icon-left ui-btn-icon-notext ui-btn-inline ui-corner-all ui-shadow">Open Panel</a>
      </div>

      <div data-role="main" class="ui-content">
        <p>FirstPage</p>
      </div>
    </div> 


    <div data-role="page" id="secondPage">
      <div data-role="panel" id="myPanel" data-display="overlay"> 
        <h2>Menu</h2>
        <br/>
        <ul data-role="listview">
              <li><a href="#firstPage" data-rel="close" >First Page</a></li>
              <li><a href="#secondPage" data-rel="close" >Second Page</a></li>
        </ul>       
      </div> 

      <div data-role="header">
        <h1>Second Page</h1>
        <a href="#myPanel" class="ui-btn ui-icon-bars ui-btn-icon-left ui-btn-icon-notext ui-btn-inline ui-corner-all ui-shadow">Open Panel</a>
      </div>

      <div data-role="main" class="ui-content">
        <p>Second Page</p>
      </div>            

</body>

Any advice or suggestions will be greatly appreciated. 任何意见或建议,将不胜感激。

You have 2 panel divs with same ID id="myPanel" 您有2个具有相同ID id="myPanel"面板div

changing the id of second panel should resolve the issue. 更改第二个面板的ID应该可以解决该问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM