fix slider 6.1

This commit is contained in:
Fred Tempez 2023-11-02 15:09:43 +01:00
parent 9a45e6f694
commit 0151edb2bb
5 changed files with 35 additions and 34 deletions

View File

@ -1,3 +1,5 @@
# Version 6.1
- Corrige le calcul de la largeur lorsque la largeur de l'écran est de 100%
# Version 6.0 # Version 6.0
- Gestion des permissions intégrée dans le module - Gestion des permissions intégrée dans le module
# Version 5.1 # Version 5.1

View File

@ -1 +1 @@
{"name":"slider","realName":"Carrousel","version":"5.1","update":"0.0","delete":true,"dataDirectory":""} {"name":"slider","realName":"Carrousel","version":"6.1","update":"0.0","delete":true,"dataDirectory":""}

View File

@ -27,7 +27,7 @@ class slider extends common
'index' => self::GROUP_VISITOR 'index' => self::GROUP_VISITOR
]; ];
const VERSION = '6.0'; const VERSION = '6.1';
const REALNAME = 'Carrousel'; const REALNAME = 'Carrousel';
const DELETE = true; const DELETE = true;
const UPDATE = '0.0'; const UPDATE = '0.0';
@ -313,11 +313,6 @@ class slider extends common
// Soumission du formulaire // Soumission du formulaire
if ($this->isPost()) { if ($this->isPost()) {
// Adapte la largeur à celle de l'écran :
$maxWidth = $this->getInput('sliderThememaxWidth', helper::FILTER_INT) === 0
? intval(trim($this->getData(['theme', 'site', 'width']), 'px')) - 40
: $this->getInput('sliderThememaxWidth', helper::FILTER_INT);
// Equilibrer les durées // Equilibrer les durées
$speed = $this->getInput('sliderThemespeed', helper::FILTER_INT); $speed = $this->getInput('sliderThemespeed', helper::FILTER_INT);
$timeout = $this->getInput('sliderThemeDiapoTime', helper::FILTER_INT); $timeout = $this->getInput('sliderThemeDiapoTime', helper::FILTER_INT);
@ -334,7 +329,7 @@ class slider extends common
'theme' => [ 'theme' => [
'pager' => $this->getInput('sliderThemePager', helper::FILTER_BOOLEAN), 'pager' => $this->getInput('sliderThemePager', helper::FILTER_BOOLEAN),
'auto' => $this->getInput('sliderThemeAuto', helper::FILTER_BOOLEAN), 'auto' => $this->getInput('sliderThemeAuto', helper::FILTER_BOOLEAN),
'maxWidth' => $maxWidth, 'maxWidth' => $this->getInput('sliderThememaxWidth', helper::FILTER_INT),
'speed' => $speed, 'speed' => $speed,
'timeout' => $timeout, 'timeout' => $timeout,
'namespace' => $this->getInput('sliderThemeNameSpace', helper::FILTER_STRING_SHORT), 'namespace' => $this->getInput('sliderThemeNameSpace', helper::FILTER_STRING_SHORT),

View File

@ -24,7 +24,7 @@
pauseControls: true, // Boolean: Pause when hovering controls, true or false pauseControls: true, // Boolean: Pause when hovering controls, true or false
prevText: "Previous", // String: Text for the "previous" button prevText: "Previous", // String: Text for the "previous" button
nextText: "Next", // String: Text for the "next" button nextText: "Next", // String: Text for the "next" button
maxwidth: "", // Integer: Max-width of the slideshow, in pixels width: "", // Integer: Max-width of the slideshow, in pixels
navContainer: "", // Selector: Where controls should be appended to, default is after the 'ul' navContainer: "", // Selector: Where controls should be appended to, default is after the 'ul'
manualControls: "", // Selector: Declare custom pager navigation manualControls: "", // Selector: Declare custom pager navigation
namespace: "rslides", // String: Change the default namespace used namespace: "rslides", // String: Change the default namespace used
@ -33,19 +33,31 @@
*/ */
$(document).ready(function() { $(document).ready(function () {
var maxWidth = "<?php echo $this->getData(['module', $this->getUrl(0),'theme', 'maxWidth']); ?>"; var maxwidth = "<?php echo $this->getData(['module', $this->getUrl(0),'theme', 'maxWidth']); ?>";
var screenwidth = "<?php echo intval(trim($this->getData(['theme', 'site', 'width']), 'px')); ?>";
var sort = "<?php echo $this->getData(['module', $this->getUrl(0),'theme', 'sort']); ?>"; var sort = "<?php echo $this->getData(['module', $this->getUrl(0),'theme', 'sort']); ?>";
// Réduction de la taille maximale selon la largeur de la section // Réduction de la taille maximale selon la largeur de la section
var screenSize = $("section").width() - 40;
maxWidth = maxWidth < screenSize ? maxWidth : screenSize; // Limiter à la largeur de l'écran
$("#wrapper").css('width', maxWidth); if (
$(function() { screenwidth !== '100%' &&
maxwidth > screenwidth
) {
mawwidth = screenwidth - 40;
}
// Largeur 100%
maxwidth = $("#site").width();
console.log(maxwidth);
$("#wrapper").css('width', "100%");
$(function () {
$("#sliders").responsiveSlides({ $("#sliders").responsiveSlides({
pager: "<?php echo (bool)$this->getData(['module', $this->getUrl(0), 'theme', 'pager']); ?>", pager: "<?php echo (bool)$this->getData(['module', $this->getUrl(0), 'theme', 'pager']); ?>",
auto: "<?php echo (bool)$this->getData(['module', $this->getUrl(0), 'theme', 'auto']); ?>", auto: "<?php echo (bool)$this->getData(['module', $this->getUrl(0), 'theme', 'auto']); ?>",
maxwidth: maxWidth, maxwidth: maxwidth,
speed: "<?php echo $this->getData(['module', $this->getUrl(0), 'theme', 'speed']); ?>", speed: "<?php echo $this->getData(['module', $this->getUrl(0), 'theme', 'speed']); ?>",
timeout: "<?php echo $this->getData(['module', $this->getUrl(0), 'theme', 'timeout']); ?>", timeout: "<?php echo $this->getData(['module', $this->getUrl(0), 'theme', 'timeout']); ?>",
namespace: "<?php echo $this->getData(['module', $this->getUrl(0), 'theme', 'namespace']); ?>", namespace: "<?php echo $this->getData(['module', $this->getUrl(0), 'theme', 'namespace']); ?>",
@ -54,8 +66,4 @@ $(document).ready(function() {
}); });
}); });
}); });

View File

@ -17,10 +17,6 @@
</ul> </ul>
</div> </div>
</div> </div>
</div>
<?php else: ?> <?php else: ?>
<?php echo template::speech('Aucune image dans le dossier sélectionné.'); ?> <?php echo template::speech('Aucune image dans le dossier sélectionné.'); ?>
<?php endif; ?> <?php endif; ?>
<div id="div1">
</div>
<!--Pour liaison entre variables php et javascript-->