我正在开发laravel 5我有一个像
这样的菜单列表1.我们做什么
print fair
图书奖
这是我想要的列表,当我点击我们做什么的时候,它会默认打印公平页面,然后打开ul li,但目前首先打开li,然后重定向到打印公平页面。
<div class="menu-wrapper">
<div class="menu-item @if(Request::route()->getName() == 'about') ? {{'selected-menu'}} : '' @endif">
<a href="{{route('about')}}">about</a>
</div>
<div class="menu-item @if(Request::route()->getName() == 'boardstaff') ? {{'selected-menu'}} : '' @endif">
<a href="{{route('boardstaff')}}">boardstaff</a>
</div>
<div class="menu-item submenu-item @if(Request::route()->getName() == 'print_fair') ? {{'selected-menu'}} : '' @endif"> <a href="{{route('print_fair')}}">What We Do</a>
<ul class="submenu-about" id="menuitem">
<div class="menu-item @if(Request::route()->getName() == 'print_fair') ? {{'selected-menu'}} : '' @endif"><a href="{{route('print_fair')}}"> <li class="pos_adjustment">Print Fair</li></a>
<div class="menu-item @if(Request::route()->getName() == 'book_award') ? {{'selected-menu'}} : '' @endif"><a href="{{route('book_award')}}"><li class="pos_adjustment">Book Award</li></a>
<div class="menu-item @if(Request::route()->getName() == 'about_foundation') ? {{'selected-menu'}} : '' @endif"><a href="{{route('about_foundation')}}"><li class="pos_adjustment">Foundation</li></a>
<div class="menu-item @if(Request::route()->getName() == 'speaker_initiative') ? {{'selected-menu'}} : '' @endif"><a href="{{route('speaker_initiative')}}"><li class="pos_adjustment">Speakers Initiative</li></a>
</ul>
</div>
<div class="menu-item @if(Request::route()->getName() == 'joining_ifpda') ? {{'selected-menu'}} : '' @endif">
<a href="{{route('joining')}}">Joining</a>
</div>
</div>
这是我的JS
$(function() {
$(".submenu-item").click(function() {
if ($(".menu-item").hasClass("active")) {
$(".menu-item").removeClass("active");
$(".submenu-item").removeClass('selected-menu');
$(".submenu-about").css('display', 'none');
} else {
$(".menu-item").addClass("active");
$(".submenu-about").css('display', 'block');
$(".submenu-item").addClass('selected-menu');
}
});
});
$("a").filter(function(){
return ( $(this).siblings('ul').length > 0 );
}).on("click", function(e) {
e.preventDefault();
// hide sibling ul element (if it exists)
$(this).siblings("ul").toggle();
window.location = "{{route('print_fair')}}";
});
现在我如何实现所需的行为,当我点击我们所做的链接它简单的重定向打印公平页面而不打开li并且打印公平页面将打开完成ul