Popups in jQuery Mobile not working as intended, please advice

心不动则不痛 提交于 2019-12-06 05:54:11

问题


Popups in jQuery Mobile not working as intended, please advice.

The popup DIV is still visible,one would expect that DIV to be hidden and it doesnt popup when the link is clicked.It seems to work in the demos in jQuery docs.

Is something wrong with the code below?

<a href="#transitionExample" data-transition="pop" data-role="button" data-inline="true" data-rel="popup">Pop Up</a>
     <div data-role="popup" id="transitionExample">
     This is a POP UP.
    </div>

回答1:


HTML

<p>You have entered: <span id="dialogoutput"></span></p>

    <a href="#" id="dialoglink" data-role="button">Open Dialog</a>

jQuery

$(document).delegate('#simplestring', 'click', function() {
  $(this).simpledialog({
    'mode' : 'string',
    'prompt' : 'What do you say?',
    'buttons' : {
      'OK': {
        click: function () {
          $('#dialogoutput').text($('#dialoglink').attr('data-string'));
        }
      },
      'Cancel': {
        click: function () { },
        icon: "delete",
        theme: "c"
      }
    }
  })
})

Referance:_

http://jquerymobile.com/branches/popup-widget/docs/pages/popup/index.html

http://dev.jtsage.com/jQM-SimpleDialog/demos/string.html




回答2:


You are using a beta feature not yet released, I would check to make sure you are using

  • jQuery 1.7.1 or later ( http://jquerymobile.com/test/js/jquery.js )
  • jQM 1.2.0 ( http://jquerymobile.com/test/js/jquery.mobile.js )
  • jQM 1.2.0 css ( http://jquerymobile.com/test/css/themes/default/jquery.mobile.css )

Live example:

  • http://jsfiddle.net/WSZ5b/1/

Docs:

  • http://jquerymobile.com/test/docs/pages/popup/index.html

Your Code:

<div data-role="page" class="type-interior">
    <div data-role="content" class="ui-body">
        <a href="#transitionExample" data-transition="pop" data-role="button" data-inline="true" data-rel="popup">Pop Up</a>
        <div data-role="popup" id="transitionExample">
            This is a POP UP.
        </div>
    </div>
</div>


来源:https://stackoverflow.com/questions/10996310/popups-in-jquery-mobile-not-working-as-intended-please-advice

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!