Files
zaufane.pl/templates_user/menu/main-menu.php
2024-11-04 19:13:57 +01:00

48 lines
2.4 KiB
PHP

<div id="main-menu">
<div id="menu-container-<?= $this -> menu['id'];?>">
<?= \front\view\Menu::pages( $this -> menu['pages'], 0, $this -> current_page );?>
</div>
</div>
<div id="main-menu-btn">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 16 16"><g fill="black"><path fill-rule="evenodd" clip-rule="evenodd" d="M14 5H2V3h12v2zm0 4H2V7h12v2zM2 13h12v-2H2v2z"/></g></svg>
</div>
<script class="footer" type="text/javascript">
$(window).resize(function() {
windowsize = $(window).width();
});
$( 'body' ).on( click_event, '#main-menu-btn', function()
{
if ( windowsize <= 767 )
{
if ( $( this ).hasClass( 'active' ) )
{
$( this ).removeClass( 'active' );
$( '#main-menu' ).removeClass( 'visible' );
$('.lang-change').removeClass('mobile');
$( '#main-menu-btn' ).html( '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 16 16"><g fill="black"><path fill-rule="evenodd" clip-rule="evenodd" d="M14 5H2V3h12v2zm0 4H2V7h12v2zM2 13h12v-2H2v2z"/></g></svg>' );
}
else
{
$( this ).addClass( 'active' );
$( '#main-menu' ).addClass( 'visible' );
$('.lang-change').addClass('mobile');
$( '#main-menu-btn' ).html( '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 20 20"><g fill="none"><path d="M7.172 14.243a1 1 0 1 1-1.415-1.415l7.071-7.07a1 1 0 0 1 1.415 1.414l-7.071 7.07z" fill="black"/><path d="M5.757 7.172a1 1 0 1 1 1.415-1.415l7.07 7.071a1 1 0 0 1-1.414 1.415l-7.07-7.071z" fill="black"/></g></svg>' );
}
}
});
$( 'body' ).on( click_event, '#menu-container-<?= $this -> menu['id'];?> > ul > li > a', function(e)
{
if ( $( this ).parent().hasClass( 'parent' ) )
e.preventDefault();
if ( isTouch || windowsize <= 767 )
{
if ( $( this ).parent( 'li' ).hasClass( 'open-menu' ) )
$( this ).parent( 'li' ).removeClass( 'open-menu' );
else
$( this ).parent( 'li' ).addClass( 'open-menu' );
}
});
</script>