slick icon indicating copy to clipboard operation
slick copied to clipboard

hash urls - go to slide

Open jasonday opened this issue 12 years ago • 62 comments

feature request.

jasonday avatar Apr 17 '14 13:04 jasonday

Good idea. Any preference on how to handle more than one slider per page?

kenwheeler avatar Apr 17 '14 13:04 kenwheeler

good question.

If a slide has an id - then the hash could match the id, so only a slideshow with that slide as an id would be affected.

jasonday avatar Apr 17 '14 15:04 jasonday

would this also scroll the page to the top of the slideshow element?

dan-diaz avatar Apr 17 '14 20:04 dan-diaz

@dan-diaz , I would think not, as you could easily add that yourself with jquery url param checking.

I think it would work ?slide=mySlideID If the slider has autoplay, it would pause autoplay for that slider.

Then if you want scroll, you can scroll to the div. (Maybe Ken will add the slide id to the data object). Additionally, you could restart the slideshow if autoplay was paused once the slideshow was interacted with, or after the scroll, etc.

In my mind, these are things that are outside of the slider (as the author can't account for every scenario/use-case)

jasonday avatar Apr 17 '14 22:04 jasonday

I want to add this, but I want to be careful about how. I want to: A. Not add too much weight. B. Not cause multi-slider conflicts C. Make it as flexible as possible

So @jasonday, your saying that , in a use case, if you hit #?slide=#thisSlide and #thisSlide is in the second carousel on the page, the plugin would pause autoplay, and jump to that slide, then not resume until the slideshow was interacted with?

kenwheeler avatar Apr 18 '14 00:04 kenwheeler

@kenwheeler

I see the plugin only doing the following:

hash-url go to slide (not scroll to slider, just ensure that the slide is the active slide) pause slideshow if is autoplay (if you don't pause, then the hash-url would be useless)

Anything else such as scroll, etc. can be handled with code outside of the plugin (developer can use the api and reenable autoplay, etc. )

jasonday avatar Apr 18 '14 00:04 jasonday

Ok, I'll shoot for 1.3.5 with this.

kenwheeler avatar Apr 18 '14 01:04 kenwheeler

http://owlcarousel.owlgraphic.com/demos/urlhashnav.html

they add an data attribut data-hash. Example: data-hash="yourhashname"

FlashJunior avatar May 29 '14 05:05 FlashJunior

Was this added/introduced officially? It's still 'open' so I'm presuming not, but this would be a great feature to have at this point.

wonderment avatar Sep 01 '14 20:09 wonderment

This feature would be really useful. :+1: It's the one thing that Slick doesn't have that Flex Slider does and I'd really prefer to use Slick! @kenwheeler Where in the implementation would you say you are? I'm willing to help out and submit a PR if there's some in-dev code that I could help with.

wldcordeiro avatar Sep 15 '14 16:09 wldcordeiro

:+1: I would also appreciate this feature - especially with the posiibility to access multiple sliders on the page for example by id/class of the slider

luflow avatar Oct 16 '14 09:10 luflow

I have created this feature. I can submit the code if you would like... Let me know. I didn't even think to check the forums for this. LMAO!

astericky avatar Oct 23 '14 19:10 astericky

Just wondering if there has been any update about this feature. Yea would find it really useful too. @astericky Is there anyway I could check out your code for this. Thanks a million.

nialljmaher avatar Dec 03 '14 14:12 nialljmaher

just a thought: If it's set via a # then I could not also send the user down to a anchor... where as with a querystring I can send the user to an anchor and change a slider. - It should also be namespaced so e-stores and blogs and such don't have problems.

mySite.com/#myTitleAnchor?slick-myCarousel=0&slick-myOtherCarousel=3

I also don't think it should interfere with pausing autoplays and such... that can easily be done with onInit() per-implementation

Honestly, though, I think good documentation on the examples page showing how to implement this in the onInit() call could be sufficient without bloating everybody's code... - my two cents :smile:

simeydotme avatar Dec 03 '14 16:12 simeydotme

@astericky can you post the code?

robinbirr avatar Dec 12 '14 10:12 robinbirr

@astericky lets see what youre working with

kenwheeler avatar Dec 14 '14 13:12 kenwheeler

Ok Ill send it along.

Chris Sanders Front-End Engineer Sent from my iPhone

On Dec 14, 2014, at 8:07 AM, Ken Wheeler [email protected] wrote:

@astericky lets see what youre working with

— Reply to this email directly or view it on GitHub.

astericky avatar Dec 14 '14 19:12 astericky

Im at a fb lunch will send after. I found the code I used. I didn't add to slick itself but I am doing this now. You can take a look when I will finish today and do a pull request.

Chris Sanders Front-End Engineer Sent from my iPhone

On Dec 14, 2014, at 8:07 AM, Ken Wheeler [email protected] wrote:

@astericky lets see what youre working with

— Reply to this email directly or view it on GitHub.

astericky avatar Dec 14 '14 19:12 astericky

I made a pull request. I implemted this feature as a url param.

astericky avatar Dec 30 '14 20:12 astericky

I did a little fiddle to demo setting individual carousels with querystrings. No additional code/change to html or slider js.

http://jsfiddle.net/x6uo6c32/

I still vote this not be a core feature, seems like additional code unecessary for most users, and probably frustrating for devs who want it to work "their way" :smile:

simeydotme avatar Dec 31 '14 14:12 simeydotme