jQuery image gallery

<html>
<head>
    <style type="text/css">
        .imgStyle {
            width100px;
            height100px;
            border3px solid grey;
        }
    </style>
    <script src="jquery-1.11.2.js"></script>
    <script type="text/javascript">

        $(document).ready(function () {
            $('#divId img').on({
                mouseover: function () {
                    $(this).css({
                        'cursor''hand',
                        'border-Color''red'
                    });
                },
                mouseout: function () {
                    $(this).css({
                        'cursor''default',
                        'border-Color''grey'
                    });
                },
                click: function () {
                    var imageURL = $(this).attr('src');
                    $('#mainImage').fadeOut(1000, function () {
                        $(this).attr('src', imageURL);
                    }).fadeIn(1000);
                }
            });
        });
    </script>
</head>
<body>
    <img id="mainImage" style="border:3px solid grey"
         src="/Images/Hydrangeas.jpg" height="500" width="540" />
    <br />
    <div id="divId">
        <img class="imgStyle" src="/Images/Hydrangeas.jpg" />
        <img class="imgStyle" src="/Images/Jellyfish.jpg" />
        <img class="imgStyle" src="/Images/Koala.jpg" />
        <img class="imgStyle" src="/Images/Penguins.jpg" />
        <img class="imgStyle" src="/Images/Tulips.jpg" />
    </div>
</body>
</html>

Comments

Popular posts from this blog

Drag and Drop multiple File upload using jQuery AJAX in ASP.Net using C# and VB.Net

jQuery dynamic menu from database in asp.net

Automatically send Birthday email using C#.Net