mirror of
https://github.com/gsi-upm/sitc
synced 2024-12-23 04:08:12 +00:00
35 lines
1.1 KiB
JavaScript
35 lines
1.1 KiB
JavaScript
|
|
||
|
/*!
|
||
|
* Bootstrap 4 multi dropdown navbar ( https://bootstrapthemes.co/demo/resource/bootstrap-4-multi-dropdown-navbar/ )
|
||
|
* Copyright 2017.
|
||
|
* Licensed under the GPL license
|
||
|
*/
|
||
|
|
||
|
|
||
|
$( document ).ready( function () {
|
||
|
$( '.mobile-drop a.dropdown-toggle' ).on( 'click', function ( e ) {
|
||
|
var $el = $( this );
|
||
|
var $parent = $( this ).offsetParent( ".mobile-drop" );
|
||
|
if ($('.show.mobile-drop').length > 0){
|
||
|
$('.show.mobile-drop').each(function(item){
|
||
|
$(this).toggleClass('show');
|
||
|
});
|
||
|
}
|
||
|
|
||
|
var $subMenu = $( this ).next( ".mobile-drop" );
|
||
|
$subMenu.toggleClass( 'show' );
|
||
|
|
||
|
$( this ).parent( "li" ).toggleClass( 'show' );
|
||
|
|
||
|
$( this ).parents( 'li.nav-item.dropdown.mobile-drop.show' ).on( 'click', function ( e ) {
|
||
|
$( '.mobile-drop .show' ).removeClass( "show" );
|
||
|
} );
|
||
|
|
||
|
if ( !$parent.parent().hasClass( 'navbar-nav' ) ) {
|
||
|
$el.next().css( { "top": $el[0].offsetTop, "left": $parent.outerWidth() - 4 } );
|
||
|
}
|
||
|
|
||
|
return false;
|
||
|
} );
|
||
|
} );
|