Multiple mouseover
Multiple mouseover
Hi
I would like to know how I can have multiple functions on the same page.
The idea as you will see is to have a pic on top of text and on mouseenter the pic is faded to show the text.
I would like to have 4 pics with the same effect on the same page.
Here is my code, it works great for one picture but not when I add the other 3:
Thank you in advance for your help
- <script type="text/javascript">
$(function() {$('#one img').mouseenter(function() { $(this).fadeOut(200);
- });
- $('#one').mouseleave(function() { $('#one img').fadeIn(200); })
- ;});
- $(function() {$('#two img').mouseenter(function() { $(this).fadeOut(200);
- });
- $('#two').mouseleave(function() { $('#two img').fadeIn(200); });
- });
- $(function() {$('#three img').mouseenter(function() { $(this).fadeOut(200); });
- $('#three').mouseleave(function() { $('#three img').fadeIn(200); })
- ;});
- $(function() {$('#four img').mouseenter(function() { $(this).fadeOut(200);
- });
- $('#four').mouseleave(function() { $('#four img').fadeIn(200); });
- });
- </script>
- <div id="one">fgjk jdjgkld fj dsfk klsd klgdjsk gljsdlk gkljsdkl fkjksd klg ksdkj gsdlk klsdjgjklsdjgkl dklf<img src="img/eye.png"></div>
- <div id="two">fgjk jdjgkld fj dsfk klsd klgdjsk gljsdlk gkljsdkl fkjksd klg ksdkj gsdlk klsdjgjklsdjgkl dklf<img src="img/water.png"></div>
- <div id="three">fgjk jdjgkld fj dsfk klsd klgdjsk gljsdlk gkljsdkl fkjksd klg ksdkj gsdlk klsdjgjklsdjgkl dklf<img src="img/eye.png"></div>
- <div id="four">fgjk jdjgkld fj dsfk klsd klgdjsk gljsdlk gkljsdkl fkjksd klg ksdkj gsdlk klsdjgjklsdjgkl dklf<img src="img/water.png"></div>