k-ivan / tabs-slider

Tabs slider

Home Page:https://k-ivan.github.io/tabs-slider/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

merge tabs title with swiper slider for slider on more count item

farshidpg opened this issue · comments

Hi, great job

But I need to have a lot of tab titles for my design, so to handle this design on desktop and mobile (with dynamic tabs ) I need to have the titles as sliders as well.

After 1 hour I was able to combine the title of the tabs with the swiper slider, but the problem is that by changing the content the swiper tabs slider does not move and the active item is not specified, which confuses the user. Do you suggest a solution?

commented

Hi @farshidpg!
Сould you please provide a sandbox link (codepen or codesandbox) with an example of the problem?

I was able to solve the explained challenge using this code

document.querySelector('.tabs').addEventListener('tabChange', function(evt) {
window.swiper_sl[1].slideTo( evt.detail.currentIndex,1000,false );
});

With these two lines, I was able to change the content, position of the tab title (created with swiper slider) ;)

tnx for this method and callback data

commented

Yes, that's right, tabslider events are just for such cases.

In that case, I'll close issue.