Question

I'm trying to add an opacity effect with jquery when we past on arrows navigation but it seems that nothing happens :(. Do you know what's wrong with my Jquery script.

Here my Jquery :

$(document).ready(function(){
  $(".flscroll").mouseenter(function(){
    $("flscroll").animate({opacity:1},300);
  });
  $(".flscroll").mouseleave(function(){
    $(".flscroll").animate({opacity:.8},300);
  });
});

I defined my arrows like in my css :

.flscroll {
        display:block;
        height: 83px;
        opacity: 0.8;
        position: fixed;
        top: 40%;
        z-index: 1000;
    }
    .ie8 .flscroll {
        filter: alpha(opacity=80);
    }
    #flscrollg {
        background: url(images/sprite.png) no-repeat 50px -100px;
        left: -30px;
        padding-left: 50px;
        width: 52px;
    }
    #flscrolld {
        background: url(images/sprite.png) no-repeat left -200px;
        padding-right: 50px;
        right: -30px;
        width: 53px;
    }

My html arrows declaration is like that :

<a href="#1" title="previous" class="flscroll" id="flscrollg">&nbsp;</a>
<a href="#1" title="next" class="flscroll" id="flscrolld">&nbsp;</a>
Was it helpful?

Solution

So I mentioned in the comment that it might be your Jquery missing the fullstop in this line of code

$("flscroll").animate({opacity:1},300);
//Should be
$(".flscroll").animate({opacity:1},300);

I have added it in this FIDDLE and it works fine.

Is this what you are after?

OTHER TIPS

try this

$(document).ready(function(){
  $(".flscroll").on('mouseenter',function(){
    $(this).animate({opacity:1},300);
  }).on('mouseleave',function(){
    $(this).animate({opacity:0.8},300);
  });
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top