苗火 Nicholas
[html]Bootstrat dropdown menu while hover
2019-3-11 萧


In order to display the dropdown menu while hover the nav, I add some scripts like this:


		function isMobile(){
if (navigator.userAgent.match(/Android/i) || navigator.userAgent.indexOf('iPhone') != -1 || navigator.userAgent.indexOf('iPod') != -1 || navigator.userAgent.indexOf('iPad') != -1) {
return true;
}
else {
return false;
}
}

$(function(){

if(!isMobile()) {
$(document).off('click.bs.dropdown.data-api');
$('li.dropdown').mouseover(function() {
$(this).addClass('open');
}).mouseout(function() {
$(this).removeClass('open');
});
}

});


 



It may need some style:


li.dropdown.open .dropdown-menu{display:block;}


 

发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容