问题
I am building an app for mobiles, using jquery mobile framework. I want to be able to make a simple dialog box/pop up, so that when you click on a picture of a "question mark" the pop up/ dialog box would appear with a simple message. I have tried different approaches from http://jquerymobile.com/test/docs/pages/dialog-alt.html to so many others. I couldnt get non of them to work. So If you know how to make a simple pop up or a simple dialog box could you please give me an example!
回答1:
If you want to open a dialog in jquery mobile you have to use an attribute data-rel="dialog"
and the href must point to a URL where your dialog lives:
<a href="http://jquerymobile.com/test/docs/pages/dialog-alt.html" data-role="button" data-rel="dialog">Open dialog</a>
Here's a fiddle so you can see how it works.
Hope it helps.
UPDATE:
It seems there's a problem with jQuery Mobile dialog and some devices.
There's an issue open in the GitHub repository.
I've found this plugin which seems to work really well.
来源:https://stackoverflow.com/questions/6938815/jquery-mobile-pop-up-dialog-box