Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

siema slider unable to function properly within tab function #282

Open
eugenetan1986 opened this issue Jan 5, 2021 · 3 comments
Open

siema slider unable to function properly within tab function #282

eugenetan1986 opened this issue Jan 5, 2021 · 3 comments

Comments

@eugenetan1986
Copy link

During switching of tab, siema slider cannot work unless browser been resize.

https://codepen.io/Eugene7/pen/LYRmyZW

Please kindly advise on this. thank you

@sammovale
Copy link

I ran into this problem and came up with a rather hacky solution. The solution is to simply "delay" the rendering with a setTimeout() of around 100ms. This is super hacky but seems to work as now it forces the element to be mounted in the visible DOM with a height before siema does its calcs and magin on the element. Again its not the best solution but it seems to work well for me so far!

@mareqj
Copy link

mareqj commented Aug 24, 2021

My solution was this:

// slick slider fix on tab switch
jQuery(document).ready(function ($) {
   $(".tab1, .tab2").click(function () {
   setTimeout(function () {
         $('.slick-slider').slick('setPosition');
      }, 0);
   });
});

It actually didn't work right without timeout 0.

@Lemon2311
Copy link

When trying this in Code Pen the slider didn't work at all for me, but when I tried running it in the browser, it worked with no issue. I just copy pasted your Code Pen files in a index.html file and ran it with the vs code live server extension and it worked fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants