Top menu submenu only works with side menu present
Forum rules
Please note that response time for technical support is within 3-5 business days.
Please note that response time for technical support is within 3-5 business days.
-
- Posts: 1
- Joined: 08 Jun 2014, 02:14
I'm not sure if it is a problem, but if you remove the side menu (leaving only the top menu) when you click on the icons nothing happens.
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
You need to change layout.js. Because, all top events depends on menu widget. You remove everything in layout.js and add the following js code into it.
Code: Select all
$(document).ready(function() {
var $this = this;
this.wrapper = $(document.body).children('.layout-wrapper');
this.topbar = this.wrapper.children('.topbar');
this.topbarMenu = this.topbar.children('.topbar-menu');
this.topbarItems = this.topbarMenu.children('li');
this.topbarLinks = this.topbarItems.children('a');
this.topbarMenuButton = $('#topbar-menu-button');
this.topbarLinkClick = false;
this.topbarMenuClick = false;
this.topbarMenuButton.on('click', function(e) {
$this.topbarMenuClick = true;
$this.topbarMenu.find('ul').removeClass('fadeInDown fadeOutUp');
if($this.topbarMenu.hasClass('topbar-menu-visible')) {
$this.topbarMenu.addClass('fadeOutUp');
setTimeout(function() {
$this.topbarMenu.removeClass('fadeOutUp topbar-menu-visible');
},500);
}
else {
$this.topbarMenu.addClass('topbar-menu-visible fadeInDown');
}
e.preventDefault();
});
this.topbarLinks.on('click', function(e) {
var link = $(this),
item = link.parent(),
submenu = link.next();
$this.topbarLinkClick = true;
item.siblings('.active-topmenuitem').removeClass('active-topmenuitem');
if(window.innerWidth > 1024) {
if(submenu.length) {
if(item.hasClass('active-topmenuitem')) {
submenu.addClass('fadeOutUp');
setTimeout(function() {
item.removeClass('active-topmenuitem'),
submenu.removeClass('fadeOutUp');
},500);
}
else {
item.addClass('active-topmenuitem');
submenu.addClass('fadeInDown');
}
}
}
else {
item.children('ul').removeClass('fadeInDown fadeOutUp');
item.toggleClass('active-topmenuitem');
}
e.preventDefault();
});
this.topbarMenu.children('.search-item').on('click', function(e) {
$this.topbarLinkClick = true;
});
$(document.body).on('click', function() {
if(!$this.topbarMenuClick && !$this.topbarLinkClick) {
$this.topbarItems.filter('.active-topmenuitem').removeClass('active-topmenuitem');
$this.topbarMenu.removeClass('topbar-menu-visible');
}
$this.topbarLinkClick = false;
$this.topbarMenuClick = false;
});
});
Github Profile: https://github.com/mertsincan
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
Please use PrimeNG forum; http://forum.primefaces.org/viewforum.php?f=35
Github Profile: https://github.com/mertsincan
-
- Information
-
Who is online
Users browsing this forum: No registered users and 4 guests