colorbox icon indicating copy to clipboard operation
colorbox copied to clipboard

Feature request: Make it possible to navigate (got to) to a particular slide index

Open Edgar-Saavedra opened this issue 8 years ago • 1 comments

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.

Edgar-Saavedra avatar Nov 28 '17 17:11 Edgar-Saavedra

+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

EliezerB123 avatar Feb 07 '21 15:02 EliezerB123