2015-07-19 157 views
0

我有一个drupal网站。它响应迅速。 在手机上,常规菜单应该以下拉菜单显示。但是,当您单击导航时,菜单选项卡出现在检查元素中,但在屏幕上它只是一个普通的蓝色框,您看不到链接。菜单下拉菜单在手机上无法正确显示

该网站是http://jspca.org.il/

<ul class="menu" style="overflow: hidden; display: block;"><li class="first leaf"><a href="/en" title="" class="active">Home</a></li> 
<li class="leaf"><a href="/en/content/about-us" title="About Us">About</a></li> 
<li class="expanded"><a href="/en/content/adoption">Adoption</a><ul class="menu"><li class="first leaf"><a href="/en/content/policy" title="">Policy</a></li> 
<li class="leaf"><a href="/en/content/contract" title="">Contract</a></li> 
<li class="leaf"><a href="/en/dogs" title="">Adopt a Dog</a></li> 
<li class="leaf"><a href="/en/Cats" title="">Adopt a Cat</a></li> 
<li class="last leaf"><a href="/en/virtual-adoption" title="">Virtual Adoption</a></li> 
</ul><span class="drop-down-toggle"><span class="drop-down-arrow"></span></span></li> 
<li class="expanded"><a href="/en/content/volunteer" title="Volunteer">Volunteer</a><ul class="menu"><li class="first leaf"><a href="/en/content/shelter">Shelter</a></li> 
<li class="leaf"><a href="/en/content/volunteer-clinic">Volunteer at the Clinic</a></li> 

@media screen and (max-device-width: 440px) { 

    .top_left, 
    .top_right, 
    .search_block, 
    .region-user-menu{ width: 100% !important; } 

    #logo { text-align: center; width: 100%; } 

    #site-title{ width: 100%; } 

    #site-title a{ width: 100%; text-align: center; float:none; /* EMS */} 

    .social-icons{ position: inherit; width: 100%; } 

    .social-icons ul{ text-align: center; } 

    .top_right .region-user-menu ul.menu{ float: none; } 

    .block-menu ul{ float: none; text-align: center; } 
} 

它看起来像style="overflow: hidden; display: block;"正在被JS文件补充说,这只是出现在移动。 我有一个被称为JS脚本:

jQuery(document).ready(function($) { 
    $('.nav-toggle').click(function() { 
    $('#main-menu div ul:first-child').slideToggle(250); 
    return false; 
    }); 
    if(($(window).width() > 640) || ($(document).width() > 640)) { 
     $('#main-menu li').mouseenter(function() { 
     $(this).children('ul').css('display', 'none').stop(true, true).slideToggle(250).css('display', 'block').children('ul').css('display', 'none'); 
     }); 
     $('#main-menu li').mouseleave(function() { 
     $(this).children('ul').stop(true, true).fadeOut(250).css('display', 'block'); 
     }) 
     } else { 
    $('#main-menu li').each(function() { 
     if($(this).children('ul').length) 
     $(this).append('<span class="drop-down-toggle"><span class="drop-down-arrow"></span></span>'); 
    }); 
    $('.drop-down-toggle').click(function() { 
     $(this).parent().children('ul').slideToggle(250); 
    }); 
    } 

}); 

这是导致该问题?我如何适应它?

回答

0

您正在使用旧的jQuery版本“v1.5.2”。 旧版本显然有bug。 最好的解决方案是将版本更改为更新的版本。如果你做不到然后修复你的CSS如下

.menu{ overflow:visible!important; } 

记得将它添加到只有小屏幕使用@media

另一种解决方案是做上述相同,但通过JS。下面添加

$('.menu').attr("style","overflow:visible"); 

行后

$('#main-menu div ul:first-child').slideToggle(250); 
+0

权我觉得溢出:隐藏正在由JavaScript添加。它只会在手机上播放。我编辑了上面的问题来显示javascript。我如何删除它? – LTech

+0

嗨LTech我编辑了我的答案上面,希望它会有所帮助。 –