Does jQuery have a handleout for .delegate('hover')?

前端 未结 5 1377
被撕碎了的回忆
被撕碎了的回忆 2020-11-30 03:58

I am trying to use:

$(\'mydiv\').delegate(\'hover\', function() {  
    $(\'seconddiv\').show();  
}, function() {  
    //For some reason jQuery won\'t ru         


        
5条回答
  •  感动是毒
    2020-11-30 04:19

    I know the OP wanted a delegate solution (so was I when I bumped into this question...)

    But after further investigation I found out its possible to achieve the same without js/jquery code at all

    All you need is a bit of CSS

    .someContainer .seconddiv{
        display : none;
    }
    
    .someContainer:hover .seconddiv{
        display : block;
    }
    

    INMO it a much more efficient/ligthwheigth solution

提交回复
热议问题