I am designing a web page. When we click the content of div named mail, how can I show a popup window containing a label email and text box?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- Carriage Return (ASCII chr 13) is missing from tex
- How to fix IE ClearType + jQuery opacity problem i
- void before promise syntax
Check out jQuery UI Dialog. You would use it like this:
The jQuery:
The markup:
Done!
Bear in mind that's about the simplest use-case there is, I would suggest reading the documentation to get a better idea of just what can be done with it.
Here is a very simple popup:
More flexible solution can be found in this tutorial: http://www.jacklmoore.com/notes/jquery-modal-tutorial/ Here's close.png for the sample.
First the CSS - tweak this however you like:
And the JavaScript:
And finally the html:
Here is a jsfiddle demo and implementation.
Depending on the situation you may want to load the popup content via an ajax call. It's best to avoid this if possible as it may give the user a more significant delay before seeing the content. Here couple changes that you'll want to make if you take this approach.
HTML becomes:
And the general idea of the JavaScript becomes:
Extremely Lightweight Modal popup plugin. POPELT - http://welbour.com/labs/popelt/
It is lightweight, supports nested popups, object oriented, supports dynamic buttons, responsive, and lot more. Next update will include Popup Ajax form submissions etc.
Feel free to use and tweet feedback.
I think this is a great tutorial on writing a simple jquery popup. Plus it looks very beautiful