Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

hovering over child elements firing mouseout

Comments

  • Registered Users, Registered Users 2 Posts: 11,989 ✭✭✭✭Giblet


    $('ul').on('mouseover','li',function(){
    var $li = $(this);
        if($li.find('div').size() == 0){
           
            $li.append('<div id="box"></div>');        
        }        $li.find('div').stop().animate({bottom:'0px'},{queue:false,duration:350});
    
        
    });
    $('ul').on('mouseout','li',function(){
     
        $(this).find('div').stop().animate({bottom:'-53px'},{queue:false,duration:300, 
    
          complete:function() {
    
          $(this).remove(); 
    
    
    }});}
    );
        
      
    


  • Registered Users, Registered Users 2 Posts: 8,070 ✭✭✭Placebo


    Thanks Giblet, i got it functioning by using the evenlistener on the li instead, however i was just wondering why the img was firing the mouseout !

    Is there any speed issues with using find ?

    cheers


  • Registered Users, Registered Users 2 Posts: 11,989 ✭✭✭✭Giblet


    Placebo wrote: »
    Thanks Giblet, i got it functioning by using the evenlistener on the li instead, however i was just wondering why the img was firing the mouseout !

    Is there any speed issues with using find ?

    cheers

    More speed issues using jQuery in general. I've taken the li "off dom" to do the find operation, so it's quite fast.

    Image was firing mouseout as you were mousing in a sibling element, so the image moused out.
    #box{
    width:100px;
    height:50px;
    background:red; 
    position:absolute;
    bottom:-53px;
    z-index:9;
        -webkit-transition: bottom .4s ease-in-out;
        -moz-transition: bottom .4s ease-in-out;
        -o-transition: bottom .4s ease-in-out;
        -ms-transition: bottom .4s ease-in-out;
        transition: bottom .4s ease-in-out;
        
        
    }
    li:hover #box {
        bottom:0px;
        
    }
    
    

    Works too (#box would need to be on the dom, but could create a document fragment and append to the li without jQuery, or just have it there in your html) If you needed to support in older browsers, remove the animation and just have it display. I wouldn't do animations in older browsers anyway!


Advertisement