在页面执行如下代码即可。
先把api事件关闭,然后再添加鼠标移上需要加载的样式名称即可
1 2 3 4 5 6 7 8 9 10 |
jQuery(document).ready(function() { $(document).off('click.bs.dropdown.data-api'); if (jQuery(window).width() > 768){ $('li.dropdown').mouseover(function() { $(this).addClass('open'); }).mouseout(function() { $(this).removeClass('open'); }); } }); |
未经允许不得转载:Windy's Blog » bootstrap设置鼠标移上显示菜单