When you click on the slide shift button, each time there is a countdown from 0px and the slide starts to scroll from 1 slide. How to make flipping the slide from the point at which I am already. How do I understand translate3d can only be used as a step? and the .animate
method duplicates the transition
from css? codepen
(document).ready(function() { $(".project-gallerey").each(function () { // ΠΎΠ±ΡΠ°Π±Π°ΡΡΠ²Π°Π΅ΠΌ ΠΊΠ°ΠΆΠ΄ΡΠΉ ΡΠ»Π°ΠΉΠ΄Π΅Ρ var obj = $(this); $(obj).append("<div class='pagination-gallerey'></div>"); $(obj).find(".slider-image").each(function () { $(obj).find(".pagination-gallerey").append("<span class='nav-pengetation' rel='"+$(this).index()+"'></span>"); // Π΄ΠΎΠ±Π°Π²Π»ΡΠ΅ΠΌ Π±Π»ΠΎΠΊ Π½Π°Π²ΠΈΠ³Π°ΡΠΈΠΈ $(this).addClass("slider"+$(this).index()); }); $(obj).find("span").first().addClass("on"); // Π΄Π΅Π»Π°Π΅ΠΌ Π°ΠΊΡΠΈΠ²Π½ΡΠΌ ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΌΠ΅Π½Ρ }); }); function sliderJS (obj, sl) { // slider function var ul = $(sl).find("ul"); // Π½Π°Ρ
ΠΎΠ΄ΠΈΠΌ Π±Π»ΠΎΠΊ var bl = $(sl).find("li.slider"+obj); // Π½Π°Ρ
ΠΎΠ΄ΠΈΠΌ Π»ΡΠ±ΠΎΠΉ ΠΈΠ· ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² Π±Π»ΠΎΠΊΠ° var step = $(bl).width(); // ΡΠΈΡΠΈΠ½Π° ΠΎΠ±ΡΠ΅ΠΊΡΠ° $(ul).animate({'opacity': step*obj }, { step: function (now, fx) { $(this).css({"transform": "translate3d( " + - now + "px, 0px, 0px)"}); }, duration: 500, easing: 'linear', queue: false, complete: function () { } }, 'linear'); // 500 ΡΡΠΎ ΡΠΊΠΎΡΠΎΡΡΡ ΠΏΠ΅ΡΠ΅ΠΌΠΎΡΠΊΠΈ } $(document).on("click", ".nav-pengetation", function() { // slider click navigate var sl = $(this).closest(".project-gallerey"); // Π½Π°Ρ
ΠΎΠ΄ΠΈΠΌ, Π² ΠΊΠ°ΠΊΠΎΠΌ Π±Π»ΠΎΠΊΠ΅ Π±ΡΠ» ΠΊΠ»ΠΈΠΊ $(sl).find("span").removeClass("on"); // ΡΠ±ΠΈΡΠ°Π΅ΠΌ Π°ΠΊΡΠΈΠ²Π½ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ $(this).addClass("on"); // Π΄Π΅Π»Π°Π΅ΠΌ Π°ΠΊΡΠΈΠ²Π½ΡΠΌ ΡΠ΅ΠΊΡΡΠΈΠΉ var obj = $(this).attr("rel"); // ΡΠ·Π½Π°Π΅ΠΌ Π΅Π³ΠΎ Π½ΠΎΠΌΠ΅Ρ sliderJS(obj, sl); // ΡΠ»Π°ΠΉΠ΄ΠΈΠΌ return false; });
opacity
property is responsible for transparency, and usually its values ββare from 0 to 1 - Grundy