ARTICLE

jQuery Image Swapping gallary using ASP.NET

Posted by Kayleigh Articles | ASP.NET using VB.NET March 16, 2011
This tutorial is about image swapping gallery where you can showcase multiple images without jumping to another page using jQuery in ASP.NET.
Download Files:
 
Reader Level:

This tutorial is about image swapping gallery or you can say photo album where you can showcase multiple images without jumping to another page, generally used for personal websites, blogs etc.

Example

<head>
<
meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>jQuery Photo Album</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $("h2").append('<em></em>')
        $(".thumbs a").click(function () {
            var largePath = $(this).attr("href");
            var largeAlt = $(this).attr("title"); 
            $("#largeImg").attr({ src: largePath, alt: largeAlt });
            $("h2 em").html(" (" + largeAlt + ")"); return false;
        });
    });
</script>
<
style type="text/css">
    body {
       margin: 20px auto;
       padding: 0;
       width: 454px;
       font: 75%/120% Arial, Helvetica, sans-serif;
}
h2 {
       font: bold 190%/100% Arial, Helvetica, sans-serif;
       margin: 0 0 .2em;
}
h2 em {
       font: normal 80%/100% Arial, Helvetica, sans-serif;
       color: #999999;
}
#largeImg {
       border: solid 1px #ccc;
       width: 439px;
       height: 248px;
       padding: 5px;
}
.thumbs img {
       border: solid 1px #ccc;
       width: 100px;
       height: 100px;
       padding: 4px;
}
.thumbs img:hover {
       border-color: #FF9900;
}
</style>
</
head>
<
body>
<
h2 style="font-family: Verdana; font-size: small; font-weight: bold">Indian Historical Monument - </h2>
<p><img id="largeImg" src="pic1.jpg" alt="Large image" /></p>
<p class="thumbs">
       <a href="pic1.jpg" title="Taj Mahal"><img src="pic1.jpg" /></a>
       <a href="pic2.jpg" title="Aakshardham Temple"><img src="pic2.jpg" /></a>
       <a href="pic3.jpg" title="Lotus Temple"><img src="pic3.jpg" /></a>
       <a href="pic4.jpg" title="Red Fort"><img src="pic4.jpg" /></a>
&nbsp;
</p>
</
body>
</
html>

Output

PhotoAlbum.gif

As you can see when you click over little thumbnails on the bottom the big box with the picture swaps the current image with the one that you clicked over. Now click on another image and see how does it swaps the older image. 

PhotoAlbum1.gif

 

Login to add your contents and source code to this article
share this article :
post comment
 

hi the zip folder is empty

Posted by Mr A Mar 22, 2011

Thank you for the tutorial. I used this code and work perfect.

Posted by Jacus Mar 17, 2011
Nevron Diagram
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Nevron Diagram
Become a Sponsor