Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

The slick carousel breaks second time loading page. #16

Closed
MattGaud2425 opened this issue Apr 12, 2016 · 10 comments
Closed

The slick carousel breaks second time loading page. #16

MattGaud2425 opened this issue Apr 12, 2016 · 10 comments

Comments

@MattGaud2425
Copy link

The first time I visit a page with the slick carousel on it it operates normally. If I route to another page and then back to the carousel the images will all stack on top of each other and the carousel will be broken. The site is also using bootstrap4 so I don't know if they are clashing.

@bodrovis
Copy link
Owner

All in all, this issue should not be reported here, because this is merely a gem that hooks slick itself https://github.com/kenwheeler/slick/

Still, judging by your description it seems you are using turbolinks. Is that correct? If yes, use https://rubygems.org/gems/jquery-turbolinks as well to restore original jQuery events.

@bodrovis
Copy link
Owner

Closed due to inactivity. If the suggested solution does not help, feel free to reopen the issue.

@raldred
Copy link

raldred commented May 26, 2016

Unfortunately jquery.turbolinks doesn't work with turbolinks 5 (yet)
kossnocorp/jquery.turbolinks#56

New Turbolinks handles things better, but I still had issues with slick not initialising properly after a turbolinks:load event. However upgrading to slick 1.6.0 seemed to resolve it

@bodrovis
Copy link
Owner

Well, that's too bad, but please understand that this is simply a wrapper for the Slick library, so it's not the best place to report such issues. What I recommend doing is searching for similar issues on StackOverflow or asking a question... I will try and and see if I can update the demo app https://github.com/bodrovis/jquery-slick-rails-demo and introduce turbolinks there to reproduce the issue.

@bodrovis
Copy link
Owner

bodrovis commented May 26, 2016

@raldred All in all, I was able to get it working with Turbolinks https://github.com/bodrovis/jquery-slick-rails-demo/blob/master/app/assets/javascripts/initialize.coffee#L1 You may use that demo app a reference.

@raldred
Copy link

raldred commented May 27, 2016

I totally understand this gem is purely a wrapper for asset pipeline but I
thought it would be useful to let others know what's going on who arrive
here from searching as I did.
Yes using turbolinks:load does resolve it as long as you have the latest
jquery-slick-rails.

On Thu, 26 May 2016, 18:43 Ilya Bodrov-Krukowski, [email protected]
wrote:

All in all, I was able to get it working with Turbolinks
https://github.com/bodrovis/jquery-slick-rails-demo/blob/master/app/assets/javascripts/initialize.coffee#L1
You may use that demo app a reference.


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#16 (comment)

@bodrovis
Copy link
Owner

@raldred Okay, great. No more issues with turbolinks for now?

@chevinbrown
Copy link

I am having trouble with turbolinks 5 still.

@bodrovis
Copy link
Owner

@chevinbrown Did you try to use this https://github.com/bodrovis/jquery-slick-rails-demo app as a reference? What issue are you having. P.S. And once again - this is a wrapper around Slick library, so I am not in charge of the JS code.

@chevinbrown
Copy link

No, I solved it...I needed to wrap my slide images in an empty div...I'm not sure that's in the docs anywhere, but I'll follow up with the author. @bodrovis, thanks for the quick reply.

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

No branches or pull requests

4 participants