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

How to link to slides from extern per #id #166

Open
Shiuyin opened this issue Aug 6, 2016 · 3 comments
Open

How to link to slides from extern per #id #166

Shiuyin opened this issue Aug 6, 2016 · 3 comments

Comments

@Shiuyin
Copy link

Shiuyin commented Aug 6, 2016

I really need to link to a page that contains a slider and let the slider open at a specific slide. I googled about an hour and found pieces of information that it should be possible. I got it working to open from extern by #name, as the name is defined by .title. This is the code i am using:

$(".liquid-slider").liquidSlider({ onload: function () { this.alignNavigation(); }, continuous: false, slideEaseFunction: "easeInOutCubic", hashLinking: true });

I just don't know how to make it not take the names as the hashtags, but the ids. Can someone explaint that to me? Thanks :)

@KevinBatdorf
Copy link
Owner

You could try something like this:

// Grab the hash
var hash = parseInt(window.location.hash.substring(1));

// If it's a number, set the first panel. Otherwise default to 1.
// You might want to add some further validation
var first = (typeof hash === "number") ? hash : 1;

$(".liquid-slider").liquidSlider({ 
  onload: function () { 
    this.alignNavigation(); 
  },
  firstPanelToLoad:first,
  continuous: false, 
  slideEaseFunction: "easeInOutCubic", 
  hashLinking: true 
});

@Shiuyin
Copy link
Author

Shiuyin commented Aug 8, 2016

Works like a charm. Thanks a lot, wouldn't have thought of that.

Also: How do I actually add new slides to slider after it has been build()? I looked into your source code and all i can see is manually caling build() again on the slider, after adding the

with the new content and destroying the old slider object. Is there a better way? :)

@KevinBatdorf
Copy link
Owner

Yeah unfortunately there isn't a clean way to do it. You might be able to add it to the array and then call some of the build functions separately but I'm not sure if it will work.

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

2 participants