jquery mobile点击h3弹出窗口

时间:2013-09-23 20:25:11

标签: jquery jquery-mobile popup

我正试图弄清楚当用户点击标题(h3)时如何打开弹出菜单。

(使用jQuery 1.9.1和jQM 1.3.1)

HTML

<div data-role='header' data-theme='b'>
  <h3 data-rel='popup' href='#projectsOpen' id='projectName'>*Untitled</h3>
</div>


<div data-role='popup' id='projectsOpen' data-theme='a' class='ui-corner-all'>
  <ul data-role='listview' id='projectList'>
   <li><input type='radio' id='newproj' checked='checked'/><span>Create New Project</span></li>
   <li><input type='radio' id='project1'/><span id='project1Title'></span></li>
  </ul>
</div>

任何人都可以了解我如何做到这一点吗?

1 个答案:

答案 0 :(得分:1)

It seems this fixs your issue..



<div data-role="page" id="p1"> 
      <div data-role='header' data-theme='b'>
      <h3 data-rel='popup' id='projectName'>*Untitled</h3>
    </div>   
    <div data-role='popup' id='projectsOpen' data-theme='a' class='ui-corner-all'>
      <ul data-role='listview' id='projectList'>
       <li><input type='radio' id='newproj' checked='checked'/><span>Create New Project</span></li>
       <li><input type='radio' id='project1'/><span id='project1Title'></span></li>
      </ul>
    </div>
  </div> 



 //jquery   

      $("#projectName").click(function(){
                $("#projectsOpen").popup("open");
        });


 you can observe here

    http://jsfiddle.net/N7Z9e/2254/