Main Function
vistaView()
Section titled “vistaView()”Creates and initializes a lightbox instance. This function is the primary entry point that instantiates the VistaView class.
Parameters:
params:VistaParams - Configuration object
Returns: VistaInterface or null if no valid elements are found or input is invalid
Example:
Configuration: See Types for:
- VistaParams - Main configuration interface
- VistaOpt - All configuration options
- VistaImgConfig - Image configuration object
Instance Methods
Section titled “Instance Methods”The vistaView() function returns a VistaInterface object with the following methods:
open(index?)
Section titled “open(index?)”Opens the lightbox at the specified index (0-based).
Parameters:
index(optional): Image index to open at (default: 0)
Example:
close()
Section titled “close()”Closes the lightbox.
Returns: Promise that resolves when close animation completes
Example:
view(index)
Section titled “view(index)”Navigates to a specific image while the lightbox is open.
Parameters:
index(required): Image index to navigate to (0-based)
Example:
next()
Section titled “next()”Navigates to the next image. Wraps to first image when at the end.
Example:
prev()
Section titled “prev()”Navigates to the previous image. Wraps to last image when at the beginning.
Example:
reset()
Section titled “reset()”Recalculates elements and re-attaches event listeners. Useful after DOM changes.
Example:
zoomIn()
Section titled “zoomIn()”Zooms in on the current image.
Example:
zoomOut()
Section titled “zoomOut()”Zooms out on the current image.
Example:
getCurrentIndex()
Section titled “getCurrentIndex()”Returns the current image index (0-based).
Returns: Current image index
Example:
destroy()
Section titled “destroy()”Destroys the lightbox instance and removes all event listeners.
Example: