2016-10-10 15:24:25 +02:00

173 lines
6.2 KiB
Smarty
Executable File

{*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{if isset($homeslider_slides)}
{if isset($HOOK_MOBILE_HEADER)}
<!-- Module HomeSlider -->
<script type="text/javascript">
{if isset($homeslider_slides) && $homeslider_slides|@count > 1}
{if $homeslider.loop == 1}
var homeslider_loop = true;
{else}
var homeslider_loop = false;
{/if}
{else}
var homeslider_loop = false;
{/if}
var homeslider_speed = {$homeslider.speed};
var homeslider_pause = {$homeslider.pause};
</script>
<ul id="homeslider">
{foreach from=$homeslider_slides item=slide}
{if $slide.active}
<li {if isset($HOOK_MOBILE_HEADER)}style="width:640px"{/if}>
<a href="{$slide.url|escape:'htmlall':'UTF-8'}" title="{$slide.description|escape:'htmlall':'UTF-8'}">
<img src="{$smarty.const._MODULE_DIR_}/homeslider/images/{$slide.image|escape:'htmlall':'UTF-8'}" alt="{$slide.legend|escape:'htmlall':'UTF-8'}" height="{if isset($HOOK_MOBILE_HEADER)}205{else}{$homeslider.height|intval}{/if}" width="{if isset($HOOK_MOBILE_HEADER)}640{else}{$homeslider.width|intval}{/if}" />
</a>
{*
<div class="homeTxt">
<span class="bloc1">
<span class="title">{$slide.title}</span>
{if $slide.subtitle!=""}<span class="subtitle">{$slide.subtitle}</span>{/if}
</span>
{if $slide.description!=""}<span class="description">{$slide.description}</span>{/if}
<a href="{$slide.url|escape:'htmlall':'UTF-8'}" title="{$slide.description|escape:'htmlall':'UTF-8'}" class="legende">{if $slide.legend!=""}{$slide.legend}{else}{l s='Prononcez la formule magique'}{/if}</a>
</div>
*}
</li>
{/if}
{/foreach}
</ul>
{else}
<!-- Module HomeSlider -->
<script type="text/javascript">{literal}
var t=0;
var totWidth=1;
var positions = new Array();
var pos=0;
var docWidth = document.body.offsetWidth || document.documentElement.offsetWidth;
var docHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
function sliderAuto(){
// var nextPos=pos;
// nextPos++;
// if($('#sliderHome #slide'+nextPos).length==0)
// nextPos=1;
$('#gallery .bx-next').click();
}
function resizeSlide() {
var nbsliderHome2 = $('#sliderHome .rubrique').length;
docWidth = document.body.offsetWidth || document.documentElement.offsetWidth;
docHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
// if(docWidth>1280){
// $('#sliderHome').css('height',hBgDiapo+'px');
// var newMargin=(1280-docWidth)/2;
// $('#gallery').css('margin',"0 "+newMargin+"px");
if(docWidth>1280){
var newMargin=(docWidth-1280)/2;
$('#gallery').css('margin',"0 -"+newMargin+"px");
}else{
var newMargin=(1280-docWidth)/2;
if(newMargin<141)
$('#gallery').css('margin',"0 "+newMargin+"px");
else
$('#gallery').css('margin',"0 141px");
}
$('#gallery,#sliderHome .rubrique').css('width',docWidth+'px');
$('#sliderHome .rubrique img').css('width','100%');
$('#sliderHome .rubrique img').css('height','auto');
var newHeight=$('#sliderHome .rubrique img').height();
$('#gallery,#sliderHome,#sliderHome div,.bx-prev,.bx-next').css('height',newHeight+"px");
totWidth=1;
$('#sliderHome .rubrique').each(function(i){
positions[i]= totWidth;
$(this).css('left',i*docWidth+"px");
totWidth += docWidth;
});
$('#sliderHome').width(nbsliderHome2*docWidth+"px");
$('#sliderHome').stop().css('left',-positions[pos]+'px');
// }
}
$(document).ready(function () {
var nbsliderHome = $('#sliderHome .rubrique').length;
/*SLIDER */
$('.bx-next').click(function(e,keepScroll){
clearTimeout(t);
pos=pos+1;
if($('#sliderHome #slide'+pos).length==0)
pos=0;
$('#sliderHome').stop().animate({left:-positions[pos]+'px'},300,function(){
t=setTimeout(function(){sliderAuto()},5000);
e.preventDefault();
});
});
$('.bx-prev').click(function(e,keepScroll){
clearTimeout(t);
pos=pos-1;
if(pos<0)
pos=nbsliderHome-1;
$('#sliderHome').stop().animate({left:-positions[pos]+'px'},300,function(){
t=setTimeout(function(){sliderAuto()},5000);
e.preventDefault();
});
});
window.onresize = resizeSlide;
})
$(window).load(function(){
resizeSlide();
if($('#sliderHome').length==1)
t=setTimeout(function(){sliderAuto()},5000);
});
{/literal}</script>
<div id="gallery" style=" overflow: hidden; position: relative; z-index: 1;height:410px">
<div id="sliderHome" style="position:absolute;height:410px">
{foreach from=$homeslider_slides item=slide key=compteur}
{if $slide.active}
<div class="rubrique" id="slide{$compteur}" style="float: left; height: 100%; position: absolute; top: 0;height:410px;">
<a href="{$slide.url|escape:'htmlall':'UTF-8'}" title="{$slide.description|escape:'htmlall':'UTF-8'}">
<img src="{$base_dir}modules/homeslider/images/{$slide.image|escape:'htmlall':'UTF-8'}" alt="{$slide.legend|escape:'htmlall':'UTF-8'}" />
</a>
</div>
{/if}
{/foreach}
</div>
<a class="bx-next" href="javascript:void(0)"></a>
<a class="bx-prev" href="javascript:void(0)"></a>
</div>
{/if}
{/if}
<!-- /Module HomeSlider -->