Feature request: Make it possible to navigate (got to) to a particular slide index
While looking into seeing if I could implement a custom dot navigation in colorbox (in addition to using the previous/next navigation), I realized that two very simple methods could help implement this and potentially allow user to do other kinds of customization of their own.
I was thinking something along the following lines would be helpful to add to the 1.x plugin
/**
* To get all elements in a particular grouping
* user can use $.data(element, 'colorbox') to
* get the rel group of a particular element.
* @param { String } rel the current grouping string/label
*/
publicMethod.getRelated = function(rel) {
return getRelated(rel);
};
/**
* Tell colorbox to go to a particular slide index
* could be used in conjunction with publicMethod.getRelated()
* to get related length
* @param { int } index
*/
publicMethod.gotoSlide = function(index) {
if($related && $related[index])
launch($related[index]);
};
@jackmoore Let me know how if there are better/other ways to do this. Or if this would be useful functionality to add to the 1.x branch of the plugin. An if so, let me know how I could go about doing a pull request.
+1.
A goToIndex function would be great! Right now we only have "Next" and "Previous".
There's already an open pull request for this, but it's 8 years old....:
https://github.com/jackmoore/colorbox/pull/377