Skip to content

Instantly share code, notes, and snippets.

@trafnar
Created April 12, 2010 22:59
Show Gist options
  • Save trafnar/364107 to your computer and use it in GitHub Desktop.
Save trafnar/364107 to your computer and use it in GitHub Desktop.
<style type="text/css">
img{display:none;}
</style>
<script type="text/javascript" charset="utf-8">
$('.link').hover(function(){
// first make sure all the images are hidden
$('img').hide();
// check which of the 3 links was hovered over,
// show the corresponding image
if($(this).hasClass('first'))
{
$('#one').show();
}
if($(this).hasClass('first'))
{
$('#two').show();
}
if($(this).hasClass('first'))
{
$('#three').show();
}
});
</script>
<html>
<a href="#" class="link first">first</a>
<a href="#" class="link second">second</a>
<a href="#" class="link third">third</a>
<img src="one.jpg" id="one" />
<img src="two.jpg" id="two" />
<img src="three.jpg" id="three" />
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment