Enlarge Image on Mouseover in ASP.NET using jQuery

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Img_Enlarge.aspx.cs" Inherits="Img_Enlarge" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" src="Scripts/jquery-1.4.1.js"></script>
    <style type="text/css">
        .thumbnail
        {
            height: 100px;
            width: 100px;
            position: relative;
        }
        .image
        {
            position: relative;
            width: 400px;
            height: 250px;
        }
    </style>
    <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            $(".thumbnail").mouseover(function () {
                $(".thumbnail").css("opacity", ".5");
                $(this).animate({ opacity: 1.0 });
                $("#imgContainer").append("<img class='image' src='" + $(this).attr("src") + "' />");

            });
            $(".thumbnail").mouseout(function () {
                $(".thumbnail").css("opacity", "1.0");
                $(".image").remove();
            });
        });
       
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    </div>
    </form>
    <div align="center">
        <img alt="" class="thumbnail" src="Images/Tree.jpg" />
        <img class="thumbnail" src="Images/dock.jpg" alt="" />
        <img class="thumbnail" src="Images/forest.jpg" alt="" />
        <img class="thumbnail" src="Images/garden.jpg" alt="" />
        <div id="imgContainer">
        </div>
    </div>
</body>
</html>


Popular Posts