diff --git a/src/script/blocs/bloc-global-sliders.js b/src/script/blocs/bloc-global-sliders.js index 5fcde5d..e4dbd0a 100644 --- a/src/script/blocs/bloc-global-sliders.js +++ b/src/script/blocs/bloc-global-sliders.js @@ -57,7 +57,7 @@ function sliderToggleHeaderAlign() { var fn_slider = function (componentName, componentSliderClass, controlsPosition, nbItems576, nbItems992, nbItems1200, gutter = 30) { var sliderElt = Array.from(document.querySelectorAll(componentName)); - if(typeof(sliderElt) != 'undefined' && sliderElt != null) { + if(sliderElt !== undefined && sliderElt != null) { sliderElt.forEach(function (slider) { var parentElt = slider.querySelector(componentSliderClass); // console.log(parentElt) diff --git a/src/script/blocs/bloc-m-key-figure.js b/src/script/blocs/bloc-m-key-figure.js index 8d38cf8..69606ee 100644 --- a/src/script/blocs/bloc-m-key-figure.js +++ b/src/script/blocs/bloc-m-key-figure.js @@ -10,7 +10,7 @@ $(function ($, win) { r = el.getBoundingClientRect(), t = r.top, b = r.bottom; - return cb.call(el, Math.max(0, t > 0 ? H - t : (b < H ? b : H))); + return cb.call(el, Math.max(0, t > 0 ? H - t : Math.min(b, H))); } visPx(); $(win).on("resize scroll", visPx); @@ -23,12 +23,12 @@ var fn_keyfigure_animated = function () { // https://jsfiddle.net/medel/8qeyr6pt/ if ($('.m-key-figure--animated').length > 0) { $(".m-key-figure--animated").inViewport(function (px) { // Make use of the `px` argument - var keyfigureNumber = $(this).text().replace(/\s/g, ""); // remove white space + var keyfigureNumber = $(this).text().replaceAll(/\s/g, ""); // remove white space // if element entered V.port ( px>0 ) and // if prop initNumAnim flag is not yet set // if it's a number // = Animate numbers - if (px > 0 && !this.initNumAnim && !isNaN(keyfigureNumber)) { + if (px > 0 && !this.initNumAnim && !Number.isNaN(Number(keyfigureNumber))) { this.initNumAnim = true; // Set flag to true to prevent re-running the same animation $(this).prop('Counter', 0).animate({ @@ -37,7 +37,7 @@ var fn_keyfigure_animated = function () { duration: 2000, easing: 'swing', step: function (now) { - $(this).text(new Intl.NumberFormat('fr-FR').format(parseFloat(now).toFixed())); + $(this).text(new Intl.NumberFormat('fr-FR').format(Number.parseFloat(now).toFixed())); } }); }