Answer the question
In order to leave comments, you need to log in
How to position on a specific slider slide when opening a page?
Hello.
There is a slider on uikit. More specifically, a slider from Yootheme Pro, a visual framework for Joomla. There are several pages on which this slider (single instance) is displayed (as a module) and acts as a menu. But the trouble is, the slider is always positioned on the first slide when the page opens. I want to make it so that when the page is opened, the slider receives a command and scrolls to the slide I need. Please tell me how to do it right.
Here, for example, we are talking about this page: sfox.mius-it.ru/doors/special - here the slider should immediately go to the 6th slide. And I don't know which way to go.
Answer the question
In order to leave comments, you need to log in
Here is the finished code for your uikit slider case:
let menu_item = document.querySelectorAll('.doorslider li > a');
for(let i = 1; i < menu_item.length; ++i){
if(menu_item[i].getAttribute('href') == window.location.pathname){
UIkit.slider('.doorslider').show(i);
}
}
you parse the address of the page into a variable, and through the conditions you check, if the condition matches, you start by scrolling to the desired ID.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question