I've been looking for why my code will not set the element to 'opacity:1' on hover but will rotate the element. the html and js is below.
the idea that if an element is unselected (has class rwunselected) then it should perform the function on hover.
<table cellpadding="0" cellspacing="10">
<tr>
<td width="135" align="center"><img class="recentworkitem rwunselected" src="images/recentwork/smallimages/cellists.png" border="0" /></td>
<td width="135" align="center"><img class="recentworkitem rwunselected" src="images/recentwork/smallimages/elegance.png" border="0" /></td>
<td width="135" align="center"><img class="recentworkitem rwunselected" src="images/recentwork/smallimages/musicrooms.png" border="0" /></td>
<td width="135" align="center"><img class="recentworkitem rwunselected" src="images/recentwork/smallimages/absolution.png" border="0" /></td>
</tr>
<tr>
<td width="135" align="center"><img class="recentworkitem rwunselected" src="images/recentwork/smallimages/helpmankind.png" border="0" /></td>
<td width="135" align="center"><img class="recentworkitem rwunselected" src="images/recentwork/smallimages/liva.png" border="0" /></td>
<td width="135" align="center"><img class="recentworkitem rwunselected" src="images/recentwork/smallimages/anthonybrown.png" border="0" /></td>
<td width="135" align="center"><img class="recentworkitem rwunselected" src="images/recentwork/smallimages/blairjohnstone.png" border="0" /></td>
</tr>
<tr>
<td width="135" align="center"><img class="recentworkitem rwunselected" src="images/recentwork/smallimages/questiventi.png" border="0" /></td>
<td width="135" align="center"><img class="recentworkitem rwunselected" src="images/recentwork/smallimages/surveycentre.png" border="0" /></td>
</tr>
</table>
javascript
//set opacities
$('.recentworkitem').css('opacity','.15');
//hover effect on all items with class recentworkitem
$('.recentworkitem').hover(function(){
if($(this).hasClass('rwunselected')){
$(this).stop().animate({opacity:'1'},{duration:300})
$(this).stop().rotate({animateTo:-90, duration:300})
}
},
function(){
if($(this).hasClass('rwunselected')){
$(this).stop().animate({opacity:'.15'},{duration:300})
$(this).stop().rotate({animateTo:0, duration:300})
}
});
//click function
$('.rwunselected').click(function(){
//swap image opacities and classes
$(this).removeClass('rwunselected');
$(this).animate({opacity:'1'},{duration:300});
$('.rwselected').addClass('rwunselected');
$('.rwselected').animate({opacity:'.15'},{duration:300});
$('.rwselected').removeClass('rwselected');
$(this).addClass('rwselected');
//rotate the old selected item back to 0 degrees
$('.rwunselected').rotate({animateTo:0, duration:300})
});