From 61a706d40847b443d89258eb9c3215454a514989 Mon Sep 17 00:00:00 2001
From: Laurent Laffont <llaffont@afi-sa.fr>
Date: Fri, 29 Sep 2017 15:29:25 +0200
Subject: [PATCH] dev #65510 fix slideshow with jquery.cycle

---
 .../modules/opac/views/scripts/java/diaporama.phtml        | 7 ++++---
 library/ZendAfi/View/Helper/TagBanniere.php                | 1 +
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/application/modules/opac/views/scripts/java/diaporama.phtml b/application/modules/opac/views/scripts/java/diaporama.phtml
index 77bf7ad6771..1d52fb62d67 100644
--- a/application/modules/opac/views/scripts/java/diaporama.phtml
+++ b/application/modules/opac/views/scripts/java/diaporama.phtml
@@ -2,8 +2,8 @@
 Class_ScriptLoader::getInstance()
 ->loadJQuery()
 ->addOPACPluginScript('diaporama/jquery.cycle.all.min.js')
-->addJQueryReady('$(".slideshow").cycle({fx:\'' . $this->preferences["op_transition"] . '\', pause:1});')
-->addInlineStyle('.slideshow { height:auto; width: 100%; margin: auto } .slideshow img { padding: 0px; border: 1px solid #ccc; background-color: #eee; }');
+->addJQueryReady('$(".slideshow").cycle({fit:1,height:' . $this->preferences["op_hauteur_boite"] . ',fx:\'' . $this->preferences["op_transition"] . '\', pause:1});')
+->addInlineStyle('.slideshow { width:' . $this->preferences["op_largeur_img"] . 'px; margin: 0 auto } .slideshow img { padding: 0px; border: 1px solid #ccc; background-color: #eee; }');
 
 $records_html = '';
 foreach($this->notices as $notice)  {
@@ -11,8 +11,9 @@ foreach($this->notices as $notice)  {
   $records_html .= $this->tagImg($this->absoluteUrl($notice->fetchUrlVignette(true)),
                                  ['title' => $notice->getTitrePrincipal(),
                                   'onclick' => $onclick,
+                                  'width' => $this->preferences["op_largeur_img"] . 'px',
                                   'style' => 'cursor:pointer']);
 }
 
-echo $this->tag('center', $this->tag('div', $records_html, ['class' => 'slideshow']));
+echo $this->tag('div', $records_html, ['class' => 'slideshow']);
 ?>
diff --git a/library/ZendAfi/View/Helper/TagBanniere.php b/library/ZendAfi/View/Helper/TagBanniere.php
index f5467d0955b..f7b0e6849de 100644
--- a/library/ZendAfi/View/Helper/TagBanniere.php
+++ b/library/ZendAfi/View/Helper/TagBanniere.php
@@ -27,6 +27,7 @@ class ZendAfi_View_Helper_TagBanniere extends Zend_View_Helper_HtmlElement {
         ->addJQueryReady(sprintf('$("#banniere a.home").cycle(%s)',
                                  json_encode(['fx' => 'fade',
                                               'width' => $this->_profil->getLargeurSite(),
+                                              'fit' => 1,
                                               'height' => $this->_profil->getHauteurBanniere()])));
     }
 
-- 
GitLab