This commit is contained in:
SBD
2023-12-08 19:57:39 +03:00
parent a22602d348
commit d97198f0dd
2 changed files with 40 additions and 3 deletions

View File

@@ -9,6 +9,8 @@ $(document).ready(function (){
}
}
})
autoplayInterval = null
function getInfoAboutUser (){
let user_type = ''
@@ -64,6 +66,7 @@ function renderContent (el=null) {
`/${lang}/section/${el.dataset['url']}/`
)
}
autoPlaySlider()
replace_select_language()
},
error: function (data){
@@ -170,7 +173,8 @@ function removeScrollBody () {
// slider
function change_slide (index_this_slide,type,list_lenght) {
function change_slide (index_this_slide,type,list_lenght,new_slide_inf){
// stopAutoPlaySlider()
let new_index_slide = null
let this_slide = document.querySelector(`[data-id-slide="${index_this_slide}"]`)
let iterator_slide = document.querySelector(".iterator_slide")
@@ -193,5 +197,38 @@ function change_slide (index_this_slide,type,list_lenght) {
iterator_slide.innerHTML = `${new_index_slide} / ${list_lenght}`
}
if (new_slide_inf){
return slide_f_show
}
}
}
function autoPlaySlider () {
let next_slide = null
let new_slide = null
if (!autoplayInterval){
autoplayInterval = setInterval(function (){
let datainf_cont
let dataset = null
if (!new_slide){
datainf_cont = document.querySelector(".functions_btns_slider")
} else {
datainf_cont = new_slide.querySelector(".functions_btns_slider")
}
dataset = datainf_cont.dataset
if (dataset){
let index_this_slide = dataset['indexSlide']
let list_lenght = dataset['lenghtSlides']
new_slide = change_slide(index_this_slide,'next',list_lenght,'new_slide_inf')
}
},2000)
} else {
// autoPlaySlider()
}
}
// function stopAutoPlaySlider () {
// if (autoplayInterval){
// clearInterval(autoplayInterval)
// }
// }

View File

@@ -10,7 +10,7 @@
</div>
{% if slide.name or slide.description %}
<div class="cut-width slider_block_text_container">
<div class="functions_btns_slider">
<div class="functions_btns_slider" data-index-slide="{{ forloop.counter }}" data-lenght-slides="{{ page.get_slides|length }}">
<img onclick="change_slide('{{ forloop.counter }}','back','{{ page.get_slides|length }}')" src="{% static "images/arrow_white_left.svg" %}">
<span class="iterator_slide">
{{ forloop.counter }} / {{ page.get_slides|length }}