You can use a few different libraries (for instance http://www.jquerypopup.com/).
Then use something like this:
$(document).ready(function() {
//Change these values to style your modal popup
var align = 'center'; //Valid values; left, right, center
var top = 100; //Use an integer (in pixels)
var padding = 10; //Use an integer (in pixels)
var backgroundColor = '#FFFFFF'; //Use any hex code
var borderColor = '#000000'; //Use any hex code
var borderWeight = 4; //Use an integer (in pixels)
var borderRadius = 5; //Use an integer (in pixels)
var fadeOutTime = 300; //Use any integer, 0 = no fade
var disableColor = '#666666'; //Use any hex code
var disableOpacity = 40; //Valid range 0-100
var loadingImage = 'lib/release-0.0.1/loading.gif'; //Use relative path from this page
//This method initialises the modal popup
$(".modal").click(function() {
var source = 'intro.php'; //Refer to any page on your server, external pages are not valid
var width = 500; //Use an integer (in pixels)
modalPopup(align, top, width, padding, disableColor, disableOpacity, backgroundColor, borderColor, borderWeight, borderRadius, fadeOutTime, source, loadingImage);
});
//This method initialises the modal popup
$(".landscape").click(function() {
var source = 'lib/landscape.jpg'; //Refer to any page on your server, external pages are not valid
var width = 920; //Use an integer (in pixels)
var top = 10; //Use an integer (in pixels)
modalPopup(align, top, width, padding, disableColor, disableOpacity, backgroundColor, borderColor, borderWeight, borderRadius, fadeOutTime, source, loadingImage);
});
//This method hides the popup when the escape key is pressed
$(document).keyup(function(e) {
if (e.keyCode == 27) {
closePopup(fadeOutTime);
}
});
});
Or use this option without plugins: How to generate a simple popup using jQuery
I found the jQuery Mobile plugin really useful:
http://jquerymobile.com/demos/1.2.0-alpha.1/docs/pages/popup/
<script src="../../../js/jquery.mobile-1.2.0-alpha.1.js"></script>
<a href="#popupBasic" data-rel="popup">Open Popup</a>
<div data-role="popup" id="popupBasic">
<p>This is a completely basic popup, no options set.<p>
</div>