如果您选择“工作”,然后选择“联系”,则子菜单似乎重叠
http://www.ogormanconstruction.co.uk/home
有没有办法只显示使用CSS选择的子菜单并隐藏其余部分,直到另外点击?
您可以使用提供的代码使用我如何执行此操作的示例:
的Javascript
<script type="text/javascript">
$(document).ready(function(){
$('#menu').rb_menu({triggerEvent: 'click', hideOnLoad: true, loadHideDelay: 0, autoHide: false, transition: 'swing'});
});
</script>
<script type="text/javascript">
$(document).ready(function(){
$('#menu2').rb_menu({triggerEvent: 'click', hideOnLoad: true, loadHideDelay: 0, autoHide: false, transition: 'swing'});
});
</script>
<script type="text/javascript">
$(document).ready(function(){
$('#services').rb_menu({triggerEvent: 'click', hideOnLoad: true, loadHideDelay: 0, autoHide: false, transition: 'swing'});
});
</script>
<div id="menu" class="menu clearfix">
<div class="toggle">Work</div>
<div class="items">
<ul>
<li><a href="http://www.ogormanconstruction.co.uk/basingstoke-treatment-works">Basingstoke Treatment Works</a></li>
<li><a href="">Project Two</a></li>
<li><a href="">Project Three</a></li>
<li><a href="">Project Four</a></li>
<li><a href="">Project Five</a></li>
<li><a href="">Project Six</a></li>
</ul>
</div>
</div>
<div id="menu2" class="menu clearfix">
<div class="toggle">Contact</div>
<div class="items">
<ul>
<li>Mick O'Gorman<br /><a href="mailto:mick@ogormanconstruction.co.uk">mick@ogormanconstruction.co.uk</a><br />+44(0) 1234 567 890<br /><br />Barry O'Gorman<br /><a href="mailto:barry@ogormanconstruction.co.uk">barry@ogormanconstruction.co.uk</a><br />+44(0) 7515 569 086</li>
</ul>
</div>
</div>
<div id="services" class="menu clearfix">
<div class="toggle">Services</div>
<div class="items">
<ul>
<li><a href="http://www.ogormanconstruction.co.uk/site-logistics">Site Logistics</a></li>
<li><a href="http://www.ogormanconstruction.co.uk/waste-management">Waste Management</a></li>
<li><a href="http://www.ogormanconstruction.co.uk/security-services">Security Services</a></li>
<li><a href="http://www.ogormanconstruction.co.uk/traffic-management">Traffic Management</a></li>
<li><a href="http://www.ogormanconstruction.co.uk/multi-service-gangs">Multi Service Gangs</a></li>
<li><a href="http://www.ogormanconstruction.co.uk/facilities">Facilities & Accommodation</a></li>
<li><a href="http://www.ogormanconstruction.co.uk/small-works-maintenance">Small Works & Maintenance</a></li>
<li><a href="http://www.ogormanconstruction.co.uk/catering-services">Catering Services</a></li>
</ul>
</div>
</div>
CSS
#menu {
position: relative;
top: 435px;
left: -15px;
width: 60px;
height: 25px;
}
#menu2 {
position: relative;
top: 445px;
left: -15px;
width: 60px;
}
#services {
position: relative;
top: 428px;
left: -15px;
width: 60px;
}
.menu .items a:hover {
text-decoration: none;
}
.menu .items a {
font-size: 11px;
color: #ABA099;
text-decoration: none;
}
.menu .items {
left: 180px;
width: 250px !important;
}
.menu .items li {
width: 250px;
line-height: 19px;
font-size: 11px;
color: #ABA099;
height: 19px;
}
.menu .items li a:hover {
color: #4D4D4F;
}
.menu .toggle {
color: #ABA099;
font-weight: normal;
}
.menu .toggle-hover {
color: #4D4D4F;
}
答案 0 :(得分:0)
您的插件正在寻找其他.items
,因此它可以在您调用插件的菜单中隐藏它们,因此如果您将所有菜单包装在1 div中并运行rb_menu()
,它可能会起作用在那。例如:
$('#menu-wrapper').rb_menu({
triggerEvent: 'click',
hideOnLoad: true,
loadHideDelay: 0,
autoHide: false,
transition: 'swing'
});