问题
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