bebeboutik/themes/site/modules/privatesales_family_menu/menu.tpl
Srv Bebeboutik 340bc7c146 push site
2016-01-04 12:48:08 +01:00

134 lines
4.1 KiB
Smarty

<div class="overlay_menu"></div>
<div class="content_menu">
<div id="sales_menu">
<ul class="nav">
{foreach from=$menus key=k item=menu}
<li class="item_{$menu.id_category_family}">
<a href="#" class="main"><span>{$menu.name}</span></a>
{if $menu.children}
<div class="container_submenu">
<div class="content_submenu">
<div class="submenu">
<ul>
{foreach from=$menu.children item=child}
<li>
<a href="#" class="sublink"><span>{$child.name}</span></a>
{if $child.sales}
<div class="sales_submenu">
<ul>
{foreach from=$child.sales item=sale}
<li>
<a class="link_sale" href="{$link->getCategoryLink($sale.id_category, $sale.link_rewrite)|escape:'htmlall':'UTF-8'}">
<img class="thumb_menu" height="50px" src="http://static3.bebeboutik.com{$sale.img}" alt="">
{$sale.name}</a>
</li>
{/foreach}
</ul>
</div>
{else}
<div class="sales_submenu">
<ul>
<li>
<a class="no_sale" href="#">{l s='Aucune vente pour le moment' mod='privatesales_family_menu'}</a>
</li>
</ul>
</div>
{/if}
</li>
{/foreach}
</ul>
</div>
</div>
</div>
{/if}
</li>
{/foreach}
</ul>
</div>
</div>
{if $page_name != 'authentication'}
<script>
{if !$cookie->isLogged()}
var siteUrl = "{$base_dir}";
{literal}
$(document).ready(function(){
$('.link_sale').unbind('click').click(function(event){
event.stopPropagation();
event.preventDefault();
var href = $(this).attr('href');
$('#login_form input[name="back"]').val(href.replace(siteUrl,'/'));
$('.modalbox_shadow').fadeIn(100);
$('.modalbox_login').fadeIn(250);
});
});
{/literal}
{/if}
img1 = new Image();
img1.src = "/themes/site/img/img_menu.jpg";
$(document).ready(function(e) {
$('#sales_menu ul li a').live('click', function(event){
var that = $(this);
var parent_li = $(this).parent('li');
if(!$(that).hasClass("activeHover")) {
$('body').addClass('nav_active');
$('.overlay_menu').show();
if($(parent_li).children(".container_submenu").length > 0
|| $(parent_li).children(".sales_submenu").length > 0) {
event.stopPropagation();
event.preventDefault();
$(".activeHover").each(function(id, el) {
if(!$.contains($(el).parent()[0], $(event.target).parent()[0])) {
if ($(el).hasClass('main')) {
$(el).parent().removeClass('active');
var submenu = $(el).parent().children('.container_submenu');
$(submenu).find(".active").each(function(id2, el2) {
$(el2).children('a.activeHover').removeClass('activeHover');
$(el2).removeClass('active');
});
$(el).removeClass('activeHover');
$(submenu).before($(submenu).clone(true)).remove();
}
if ($(el).hasClass('sublink')) {
$(el).parent().parent().find('li.active').each(function(id2, el2) {
$(el2).removeClass('active');
$(el).removeClass('activeHover');
var submenu = $(el2).children('.sales_submenu');
$(submenu).before($(submenu).clone(true)).remove();
});
}
}
});
$(that).addClass('activeHover');
$(parent_li).addClass('active');
}
}
});
// LEAVE NAV
$('#header .nav').mouseleave(function(event){
$('body').removeClass('nav_active');
$('.overlay_menu').hide();
$("#sales_menu a.activeHover").each(function(index, el) {
$(el).removeClass('activeHover');
});
$("#sales_menu > ul > li.active").each(function(index, el) {
var submenu = $(el).children('.container_submenu');
$(el).removeClass('active');
$(submenu).before($(submenu).clone(true)).remove();
});
$(".submenu ul li.active").each(function(index, el) {
var submenu = $(el).children('.sales_submenu');
$(el).removeClass('active');
$(submenu).before($(submenu).clone(true)).remove();
});
});
});
</script>
{/if}