-
Notifications
You must be signed in to change notification settings - Fork 429
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
# Adds public showImage method #128
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -603,6 +603,15 @@ | |
} | ||
return returnValue; | ||
} | ||
|
||
// opens specific image | ||
function showImage(selector, imageIndex) { | ||
if ( null === imageIndex || undefined === imageIndex || '' === imageIndex ){ | ||
imageIndex = 0; | ||
} | ||
var activeImage = baguetteBox.data[selector].galleries[0][imageIndex]; | ||
activeImage.eventHandler(activeImage); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to check that given index doesn't exceed the elements count: if (activeImage) {
activeImage.eventHandler(new MouseEvent('click'))
} I've also replaced |
||
} | ||
|
||
function updateOffset() { | ||
var offset = -currentIndex * 100 + '%'; | ||
|
@@ -692,9 +701,11 @@ | |
|
||
return { | ||
run: run, | ||
data: data, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we make this data public? |
||
destroy: destroyPlugin, | ||
showNext: showNextImage, | ||
showPrevious: showPreviousImage | ||
showPrevious: showPreviousImage, | ||
showImage: showImage, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the trailing comma, it's not supported by IE. |
||
}; | ||
|
||
})); | ||
})); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing final newline. I recommend using editorconfig.org 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd replace this check with: