From: nael Date: Tue, 18 Jun 2019 16:15:10 +0000 (+0200) Subject: wip #2747 @5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=b40a397f3739d78539532217f19a59c190573882;p=pmi.git wip #2747 @5 --- diff --git a/public/_modules/home-slider/index.html b/public/_modules/home-slider/index.html index 939f053..4714a4f 100644 --- a/public/_modules/home-slider/index.html +++ b/public/_modules/home-slider/index.html @@ -32,8 +32,8 @@
- -
+ +

Wheel Force Transducer

@@ -60,10 +60,10 @@
-
+ \ No newline at end of file diff --git a/public/_modules/home-slider/slider.js b/public/_modules/home-slider/slider.js index d7325f0..3eb0a38 100644 --- a/public/_modules/home-slider/slider.js +++ b/public/_modules/home-slider/slider.js @@ -1,5 +1,47 @@ // jshint ignore: start -$('.arrow').on('click',function () { - alert('test'); +let index = $(".column-wrapper.active").index(".column-wrapper"), + stepsCount = $(".column-wrapper").length, + prevBtn = $(".home-arrow-left"), + nextBtn = $(".home-arrow-right"); + +// Slider variables +let animationDuration = 0; +let delayBetweenAnim = 2000; +let mouvement = 0; + +prevBtn.click(function() { + nextBtn.prop("disabled", false); + + if (index > 0) { + index--; + $(".column-wrapper").removeClass("active").eq(index).addClass("active"); + }; + + if (index === 0) { + $(this).prop("disabled", true); + } +}); + +nextBtn.click(function() { + setTimeout(function () { + prevBtn.prop("disabled", false); + + if (index < stepsCount - 1) { + index++; + + //TODO animation when the first slide go out + // $(".column-wrapper").removeClass("active").eq(index); + $(".column-wrapper").removeClass("active").eq(index).addClass("active"); + + //TODO animation when the second slide appear + + console.log(index); + }; + }, delayBetweenAnim); + + + if (index === stepsCount - 1) { + $(this).prop("disabled", true); + } }); \ No newline at end of file diff --git a/public/_modules/home-slider/style.styl b/public/_modules/home-slider/style.styl index e40e44e..1cb2633 100644 --- a/public/_modules/home-slider/style.styl +++ b/public/_modules/home-slider/style.styl @@ -13,6 +13,8 @@ $verylightgrey =#E7E9F3 box-sizing: border-box !important margin: 0 font-family: $muli +.column-wrapper.hide + display none .arrow cursor: pointer .home-arrow-left @@ -22,4 +24,6 @@ $verylightgrey =#E7E9F3 .home-arrow-right position: absolute; top: 50%; - right: 2%; \ No newline at end of file + right: 2%; +.column-wrapper.active + display grid