Hover/Fadeto/Toggle Multiple Class Changing
Posted
by Slick Willis
on Stack Overflow
See other posts from Stack Overflow
or by Slick Willis
Published on 2010-05-07T17:47:27Z
Indexed on
2010/05/07
18:28 UTC
Read the original article
Hit count: 268
So my problem is rather simple and complex at the same time. I am trying to create links that fade in when you mouseover them and fade out when you mouseout of them. At the same time that you are going over them I would like a pic to slide from the left. This is the easy part, I have every thing working. The image fades and another image slides. I did this by using a hover, fadeto, and toggle("slide"). I would like to do this in a table format with multiple images being able to be scrolled over and sliding images out. The problem is that I am calling my sliding image to a class and when I hover over the letters both images slide out. Does anybody have a solution for this?
I posted the code that I used below:
<html>
<head>
<script type='text/javascript' src='http://accidentalwords.squarespace.com/storage/jquery/jquery-1.4.2.min.js'></script>
<script type='text/javascript' src='http://accidentalwords.squarespace.com/storage/jquery/jquery-custom-181/jquery-ui-1.8.1.custom.min.js'></script>
<style type="text/css">
.text-slide { display: none; margin: 0px; width: 167px; height: 50px; }
</style>
<script>
$(document).ready(function(){
$(".letterbox-fade").fadeTo(1,0.25);
$(".letterbox-fade").hover(function () {
$(this).stop().fadeTo(250,1);
$(".text-slide").toggle("slide", {}, 1000);
},
function() {
$(this).stop().fadeTo(250,0.25);
$(".text-slide").toggle("slide", {}, 1000);
});
});
</script>
</head>
<body style="background-color: #181818">
<table>
<tr>
<td><div class="letterbox-fade"><img src="http://accidentalwords.squarespace.com/storage/sidebar/icons/A-Letterbox-Selected.png" /></div></td>
<td><div class="text-slide"><img src="http://accidentalwords.squarespace.com/storage/sidebar/icons/TEST.png" /></div></td>
</tr>
<tr>
<td><div class="letterbox-fade"><img src="http://accidentalwords.squarespace.com/storage/sidebar/icons/B-Letterbox-Selected.png" /></div></td>
<td><div class="text-slide"><img src="http://accidentalwords.squarespace.com/storage/sidebar/icons/TEST.png" /></div></td>
</tr>
</table>
</body>
</html>
© Stack Overflow or respective owner