Bootstrap移动下拉父链接问题

时间:2014-01-30 11:05:26

标签: javascript jquery html css twitter-bootstrap

我正在使用以下JS来悬停我的bootstrap v3导航。

我这样做了,以便父链接可以是一个链接。

<script type="text/javascript">     
        jQuery(function($) {
 $('.navbar .dropdown').hover(function() {
 $(this).find('.dropdown-menu').first().stop(true, true).delay(250).slideDown();


}, function() {
 $(this).find('.dropdown-menu').first().stop(true, true).delay(100).slideUp();


});


$('.navbar .dropdown > a').click(function(){
 location.href = this.href;
 });


});
</script>

我在移动设备上遇到了一个问题,你点击了父链接,你偶尔会看到子链接 - 但是你会直接看到父链接...所以你没有能力选择父母下方的子链接。

网站:http://crawfordtech.fastnetstaging.co.uk

有问题的父链接称为“解决方案”。

有什么想法可以做什么?

1 个答案:

答案 0 :(得分:0)

你可以把它包裹在一个条件中,所以当你需要它时它会运行 我只是从之前的项目中复制了pasta,所以忽略或随意使用里面的脚本。它也会让人失望。

<script type="text/javascript">
//boostrap hover script
 jQuery(document).ready(function($){
if ($(document).width() > 800){
(function(e,d,b){var a=0;var f=null;var c={x:0,y:0};e("[data-toggle]").closest("li").on("mouseenter",function(g){if(f){f.removeClass("open")}d.clearTimeout(a);f=e(this);a=d.setTimeout(function(){f.addClass("open")},b)}).on("mousemove",function(g){if(Math.abs(c.x-g.ScreenX)>4||Math.abs(c.y-g.ScreenY)>4){c.x=g.ScreenX;c.y=g.ScreenY;return}if(f.hasClass("open")){return}d.clearTimeout(a);a=d.setTimeout(function(){f.addClass("open")},b)}).on("mouseleave",function(g){d.clearTimeout(a);f=e(this);a=d.setTimeout(function(){f.removeClass("open")},b)})})(jQuery,window,200);
}});
</script>
相关问题