Click here to Skip to main content
15,886,689 members
Please Sign up or sign in to vote.
1.24/5 (3 votes)
See more:
how to get large image while mouse over a small image plz help me if u possible.............
Posted
Updated 10-May-17 5:17am
Comments
Sandeep Mewara 12-May-12 4:57am    
Did you tried anything?

It's easy with jQuery:

HTML
<html>
<head>
    <title> ... </title>
    <script type="text/javascript" src="scripts/jquery-1.7.1.min.js"></script>
</head>
<body>

	<img alt="Image" id="image" />	
	
	<script type="text/javascript">

                $(document).ready(function() {
			imageElement = $("#image"); // element img found by its attribute id="image"
			imageElement.attr("src", "small.png"); // start with small image
			imageElement.hover(
				function() { // mouse moves over the image
					$(this).attr("src", "big.png");
				},
				function() { // mouse goes out
					$(this).attr("src", "small.png");
				}
			);
		});
        
        </script>

</body>
</html>


I assume you have two images "small.png" and "big.png", basically, both could be made from the same source image, but "small.png" was re-sampled down to smaller size with same aspect ratio.

It works, tested.

If you need to learn jQuery, please see:
http://en.wikipedia.org/wiki/JQuery[^],
http://jquery.com/[^],
http://docs.jquery.com/Tutorials:How_jQuery_Works[^],
http://docs.jquery.com/Tutorials[^].

—SA
 
Share this answer
 
v6
Comments
VJ Reddy 12-May-12 23:24pm    
My 5!
Sergey Alexandrovich Kryukov 13-May-12 0:34am    
Thank you, VJ.
--SA
 
Share this answer
 
Comments
Maciej Los 12-May-12 4:47am    
Useful links, 5!
P.Salini 12-May-12 4:59am    
Thank you losmac
VJ Reddy 13-May-12 0:41am    
My 5!
P.Salini 14-May-12 0:02am    
Thank you VJ
Hi,
you can use jquery lightbox :
jquery lightbox1
jquery lightbox2
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900