2016-05-12 20 views
0

我有一個下拉列表,我已經將mouseenter設置爲選項。所以如果鼠標在觸發器外面,菜單應該關閉。我正在使用jQuery 1.8.0。這可能是一個CSS問題?Dropit下拉不隱藏在mouseleave

這是我的代碼來初始化插件。

<script> 
     $(document).ready(function() { 
      $('.dropit-trigger').dropit({ 
       action: 'mouseenter' 
      }); 
     }); 
     </script> 

這是插件中此選項的代碼。怎麼了?

if(settings.action == 'mouseenter'){ 
    $el.on('mouseleave', '.dropit-open', function(){ 
    settings.beforeHide.call(this); 
    $(this).removeClass('dropit-open').find(settings.submenuEl).hide(); 
    settings.afterHide.call(this); 
    }); 
} 
+0

請提供html和css或jsfiddle/codepen鏈接到演示。 – kbysiec

+0

@kbysiec這裏是活的網站:http://patrickhofer.ch/ff/superfish/tmplt_stt_pool.php – olivier

+0

@olivier但jsfiddle鏈接更有幫助。 –

回答

1

,而不是使用jQuery你可以用下面這個CSS來顯示/隱藏下拉菜單。

.dropit-trigger:hover .dropit-submenu-right { 
    display : block !important; 
} 
0

您的jQuery更改爲

<script> 
    $(document).ready(function() { 
     $('.navi').dropit({ 
      action: 'mouseenter' 
     }); 
    }); 
</script>