Комментарии:
Just modified the script in some parts:
**** START OF THE modified script ****
jQuery(document).ready(function ($) {
let index = 0;
let delay = 5000;
let $tabs = $('.tab_wrap .tab');
let $contents = $('.content_wrap .box');
let interval = setInterval(rotate, delay);
$tabs.eq(0).addClass('active');
$tabs.each(function (i) {
$(this).click(function () {
index = i;
switchElement();
});
});
function rotate() {
index++;
if (index >= $tabs.length) {
index = 0;
}
switchElement();
}
function switchElement() {
clearInterval(interval);
$tabs.removeClass('active');
$contents.fadeOut(300);
$tabs.eq(index).addClass('active');
$contents.eq(index).delay(300).fadeIn(300);
interval = setInterval(rotate, delay);
}
});
**** END OF THE modified script ****
I made the following changes:
- Simplified the selection of the tabs and content elements, eliminating the unnecessary wrapping elements and using more concise selectors.
- Removed the redundant use of children when selecting the tabs and content elements.
- Simplified the way the "active" class is added and removed from tabs.
- Removed unnecessary repetition of selectors in the switchElement function.
- Reordered some statements for better readability.
Very nice, thank you, but, it would be very helpful to add your code in the comment section so you don' t have to type everything in to experiment with it.
Thanks again
Thank you so much man! it works just fine. But I am facing a problem like if you keep the tab open and come back after some time the animation looks so odd.
ОтветитьThis is not working for me
ОтветитьHi, good guide. But i cannot find "inner section" option in elemntor. Can you help?
ОтветитьReally greate & amazing
ОтветитьReally great tutorial and content.
ОтветитьHello, my screen flickers when switching the tab every time. Do you know how can I fix this? Great tutorial btw.
ОтветитьHi nice video its really helped and small thing without auto switching what will be the code?
ОтветитьWhen I click to tab can I increase time to pause near 30 second
but switch timing is normal 5 second
Great work Avro thanks
I tried but didn't work
can you add your code on the comments to test
many thanks
where is the code
ОтветитьHi bro your content is amazing, but channel is underrated.... 😒
ОтветитьHow to change the background image or video for each elementor section for each
Tab, please? Thank you for the tutorial.
thanks
ОтветитьThank you.
ОтветитьGreat work keep it up 👍
Ответить