Please could anyone help me in this simple script...
<script>
$(".offr-list-desc-anch").hide();
$(function () {
$(".grey-shadow").hover(function () {
$(".offr-list-desc-anch").stop().fadeIn()
}, function () {
$(".offr-list-desc-anch").stop().fadeOut();
});
});
</script>
I use this to fade in and out my links but when I hover one link, the effect happens to all other links... I just want to take effect only on the hovered link..
this is my HTML
<a href="#" class="offr-list-itm grey-shadow">
<div class="offr-list-desc-txt">
<img width="223" height="159" border="0" class="grey-shadow" src="images/sportive_suit.jpg">
<div class="offr-list-desc-anch" >
<div class="offr-list-item-detls">
<div class="price"><span class="price-value">200</span><span>LE</span></div>
<div class="discount-box">
<div class="off"><span class="price-detalis-tit">Discount</span> <span class="save-currency">50 <span class="save-currency-symbol">%</span> </span> </div>
<div class="save"> <span class="price-detalis-tit">You Save</span> <span class="save-currency"> 200 <span class="save-currency-symbol"> LE </span></span> </div>
</div>
</div>
<p class="more-offers-unitit"> L.E 200 Instead of L.E 400 for 1 Month of Self Defense Classes from Circle Aikido</p>
</div>
<script>
$(".offr-list-desc-anch").hide();
$(function(){
$(".grey-shadow").stop().hover(function(){
$(".offr-list-desc-anch").fadeIn()
},function(){$(".offr-list-desc-anch").stop().fadeOut();
});
return false;
});
</script>
</div>
</a>
You need to specify the target which is specific to the current hovered element so that it doesn't impact other elements. So try this way:
$(function () {
$(".offr-list-desc-anch").hide();
$(".grey-shadow").hover(function () {
$(this).find(".offr-list-desc-anch").stop().fadeToggle(); //find the element specific to hovered anchor tag element
});
});
Also do not wrap the scripts inside the div element, you don't need to do that.