开发者

jQuery Mouseover if statement inside of hover statement

开发者 https://www.devze.com 2023-01-26 00:21 出处:网络
Can someone please look at my code and tell me where I am going wrong? $(\"div.inner\").hover(function(){

Can someone please look at my code and tell me where I am going wrong?

$("div.inner").hover(function(){
    $("span.arrowL, span.arrowR").fadeIn("slow");
    if ($('div#move_next').mouseover()){
      return false; 
    } else {
      return true;
    }
  },
  function(){
    $("span.arrowL, span.arrowR").fadeOut();
  });
});

I am trying to get background images to fade in on a hover and if someone hovers over a certain area I want the arrows to stay there instead of fad开发者_如何学Goe out.


Thinking that once hovering over the arrowL or arrowR elements the hover for the overall parent container is no more and the fade out is called.


Try this:

$('#move_prev').mouseover(function() {
    $('span.arrowL').stop(true).css('opacity', 1);
});

$('#move_next').mouseover(function() {
    $('span.arrowR').stop(true).css('opacity', 1);
});

This should stop the fade-out from happening on the arrow the user's mouse pointer moves over and reverse that part of the fade-out has already been done. This is necessary because #move_prev and #move_next are not inside div.inner, so that's why the arrows hide.

0

精彩评论

暂无评论...
验证码 换一张
取 消