Jack Moore created an easy-to-use dialog (popup) box.
Follow these steps to create a simple version. Keep in mind, there are several options/features and this demo will create an inline version, which should cover most of your needs.
colorbox-basic.css
to the <head>
section of your page.jquery.colorbox-min.js
) to your website.<a>
tag) that will display the popup box.
class="colorbox"
<div>
’s ID attribute. Example: <a href="#example" class="colorbox">Show More...</a>
<div id="example">
).<div>
in a another <div>
and hide it.<script type="text/javascript"> $(document).ready(function(){ $('.colorbox').colorbox({ inline:true, opacity:0.5 }); }); </script>
Here is an example of it in action.
The easiest way to get started is to download this example and play with it.
Colorbox is primarily geared to work with <a>
tags and the contents of the colorbox will come from the href attribute of the link. Here is a typical case:
<a href="myPage.html class="colorbox">Show Content</a> <script> $('.colorbox').colorbox(); </script>
It can also act as a slideshow for content, or images, depending on what you have in the href
attribute. For a somewhat edge-case example of a slideshow, see this example.