In this tutorial you will know how to create image gallery via ajax using jQuery tools, First we must include the library on the HEAD section of the page.
<!-- Full version of jQuery Tools + jQuery 1.3.2 -->
<script type="text/javascript" src="js/jquery.tools.min.js"></script>
Second we are going to apply styles to our overlay:
/* scrollable should not disable gallery navigation */
#gallery .disabled {
visibility:visible !important;
}
#gallery .inactive {
visibility:hidden !important;
}
/* the overlayed element */
.simple_overlay {
/* must be initially hidden */
display:none;
/* place overlay on top of other elements */
z-index:10000;
/* styling */
background-color:#333;
width:675px;
min-height:200px;
border:1px solid #666;
/* CSS3 styling for latest browsers */
-moz-box-shadow:0 0 90px 5px #000;
-webkit-box-shadow: 0 0 90px #000;
}
/* close button positioned on upper right corner */
.simple_overlay .close {
background-image:url(images/overlay/close.png);
position:absolute;
right:-15px;
top:-15px;
cursor:pointer;
height:35px;
width:35px;
}
/* styling for elements inside overlay */
.simple_overlay .details {
position:absolute;
top:15px;
right:15px;
font-size:11px;
color:#fff;
width:150px;
}
.simple_overlay .details h3 {
color:#aba;
font-size:15px;
margin:0 0 -10px 0;
}
/* "next image" and "prev image" links */
.next, .prev {
/* absolute positioning relative to the overlay */
position:absolute;
top:40%;
border:1px solid #666;
cursor:pointer;
display:block;
padding:10px 20px;
color:#fff;
font-size:11px;
/* upcoming CSS3 features */
-moz-border-radius:5px;
-webkit-border-radius:5px;
}
.prev {
left:0;
border-left:0;
-moz-border-radius-topleft:0;
-moz-border-radius-bottomleft:0;
-webkit-border-bottom-left-radius:0;
-webkit-border-top-left-radius:0;
}
.next {
right:0;
border-right:0;
-moz-border-radius-topright:0;
-moz-border-radius-bottomright:0;
-webkit-border-bottom-right-radius:0;
-webkit-border-top-right-radius:0;
}
.next:hover, .prev:hover {
text-decoration:underline;
background-color:#000;
}
/* when there is no next or previous link available this class is added */
.disabled {
visibility:hidden;
}
/* the "information box" */
.info {
position:absolute;
bottom:0;
left:0;
padding:10px 15px;
color:#fff;
font-size:11px;
border-top:1px solid #666;
}
.info strong {
display:block;
}
/* progress indicator (animated gif). should be initially hidden */
.progress {
position:absolute;
top:45%;
left:50%;
display:none;
}
/* everybody should know about RGBA colors. */
.next, .prev, .info {
background:#333 !important;
background:rgba(0, 0, 0, 0.6) url(images/h80.png) repeat-x;
}
Now the HTML holder:
<!-- overlay element -->
<div class="simple_overlay" id="gallery">
<!-- "previous image" action -->
<a class="prev">prev</a>
<!-- "next image" action -->
<a class="next">next</a>
<!-- image information -->
<div class="info"></div>
<!-- load indicator (animated gif) -->
<img class="progress" src="images/ajax-loader.gif" />
<!-- end of overlay element -->
</div>
PHP Response:
Here we are going to check is how is the PHP response in order to make our Image Gallery work after an Ajax call.
// ************************************
// Scenario: An ajax call to this PHP script was done and
// a POST variable has been sent in order to fill $pics from
// a database.
//
// pics == array of pictures
// ************************************
// loop the array
foreach($pics as $pic)
{
// check the class attribute --> ibox
// $pic is also an object with certain properties in this case
$html .= <div class="pic">
<a href=".$pic->imgPath.$pic->strName." class="ibox" title=".$pic->strName.">
<img src=".$pic->imgPath.$pic->strName." width="50" border="0" /></a>
</div>;
}
//
// here I create the necessary javascript code to load the OVERLAY object of JQuery Tools
// please check the ibox call
//
$html .=
<script type="text/javascript">
//<![CDATA[
$(.ibox).overlay({
target: #gallery,
expose: #f1f1f1
}).gallery({
speed: 800 });
//]]></script>;
//
// echo response
//
echo $html;
Related Stuff
-
MooV: Using cutting edge Video phones and Software Video Phones - coupling all that with VoIP and empowering the disabled.
-
Moo Telecom: VoIP communications made easy - Ring anyway with the fun and ease of using a normal phone
-
TagR:Mobile Social Network with Real Time Locations Based services, and Ambience Intelligence, VoiP, IM, Skype, Googletalk, Mapping, Flickr, Events, Calendaring, Scheduling, SecondLife Support
-
ClearSMS : ClearSMS is a Web-based application that lets you send bulk SMS messages to your customers, contacts, or just about anyone.
-
Jajah:jah is a VoIP (Voice over IP) provider, founded by Austrians Roman Scharf and Daniel Mattes in 2005[1]. The Jajah headquarters are located in Mountain View, CA, USA, and Luxembourg. Jajah maintains a development centre in Israel.
-
Skype: It’s free to download and free to call other people on Skype. Skype the number one voice over ip software
- PrivatePhone: a free local phone number with voicemail and messages you can check online or from any phone.

Original Source: