A.ImageViewerMultiple Class
The base class for Image Viewer.
Constructor
A.ImageViewerMultiple
-
config
Parameters:
-
config
ObjectObject literal specifying widget configuration properties.
Index
Methods
- _afterAttachSwipeEvents
- _afterCurrentIndexChange
- _afterMultipleBindUI
- _afterMultipleCurrentIndexChange
- _afterMultipleRenderUI
- _afterMultipleResponsive
- _afterPreloadAllImagesChange
- _afterResponsive
- _afterScrollXChange
- _afterShowControlsChange
- _afterSourcesChange
- _afterUISetVisible
- _bindClickImages
- _bindControls
- _calculateOriginalDimensions
- _canChangeHeight
- _canChangeWidth
- _defAnimateFn
- _defImageClicked
- _defMakeImageVisible
- _defResponsiveFn
- _getCurrentImage
- _getCurrentImageContainer
- _getImageContainer
- _getImageContainerAtIndex
- _handleResponsive
- _isImageVisible
- _loadImage
- _loadVisibleImages
- _onClickControl
- _onClickImage
- _onCurrentImageReady
- _onImageClicked
- _onImageLoad
- _onMakeImageVisible
- _onMousedown
- _onResponsive
- _preloadAll
- _renderControls
- _renderImage
- _renderImageContainers
- _renderImageListNode
- _renderImages
- _renderImagesForFirstTime
- _setCurrentIndex
- _setImageAnim
- _showCurrentImage
- _syncAriaCurrentImageUI
- _syncControlsUI
- _updateCurrentImageCSS
- bindUI
- destructor
- hasNext
- hasPrev
- initializer
- initializer
- next
- prev
- renderUI
- updateDimensions
- updateDimensionsWithNewRatio
Properties
- CSS_PREFIX static
Attributes
Methods
_afterAttachSwipeEvents
()
protected
Attaches swipe events for the viewer's thumbnails.
_afterCurrentIndexChange
-
event
<p>Fired after the <code>currentIndex</code> attribute is set.</p>
Parameters:
-
event
EventFacade
_afterMultipleBindUI
()
protected
Fired after the bindUI
method runs.
_afterMultipleCurrentIndexChange
()
protected
Fired after the currentIndex
attribute is set.
_afterMultipleRenderUI
()
protected
Fired after the renderUI
method runs.
_afterMultipleResponsive
()
protected
Fired after the responsive
event is triggered.
_afterPreloadAllImagesChange
()
protected
<p>Fired after the <code>preloadAllImages</code> attribute is changed.</p>
_afterResponsive
()
protected
<p>Fired after the <code>responsive</code> event.</p>
_afterScrollXChange
()
protected
Fired after the scroll view's scrollX
attribute changes.
_afterShowControlsChange
()
protected
<p>Fired after the <code>showControls</code> attribute is changed.</p>
_afterSourcesChange
()
protected
<p>Fired after the <code>sources</code> attribute is changed.</p>
_afterUISetVisible
()
protected
<p>Fired after the <code>visible</code> attribute is set.</p>
_bindClickImages
()
protected
Binds the events for clicking images.
_bindControls
()
protected
<p>Binds the events related to the viewer's controls.</p>
_calculateOriginalDimensions
()
Object
protected
Calculates the original width and height of the widget, which will be used when changing its dimensions to preserve its ratio.
Returns:
<p><p>An object with the original dimensions</p></p>
_canChangeHeight
()
Boolean
Checks if the height can be manually changed.
Returns:
_canChangeWidth
()
Boolean
Checks if the width can be manually changed.
Returns:
_defAnimateFn
()
protected
<p>Default behavior for animating the current image in the viewer.</p>
_defImageClicked
()
protected
Default behavior for the imageClicked
event. The current index is updated
to point to the image that was clicked.
_defMakeImageVisible
()
protected
Default behavior for the makeImageVisible
event. The scroll position is
updated to make the specified image visible.
_defResponsiveFn
-
event
Default behavior for the responsive
event. It updates the dimensions of
the widget so it will respect the preserveRatio
, maxHeight
and maxWidth
attributes.
Parameters:
-
event
EventFacade
_getCurrentImageContainer
()
protected
<p>Returns the container node for the current image.</p>
_getImageContainer
()
protected
<p>Returns the image container node.</p>
_getImageContainerAtIndex
-
index
<p>Returns the container node at the requested index.</p>
Parameters:
-
index
Number
_handleResponsive
()
protected
Fires the responsive
event.
_isImageVisible
-
image
Checks if the image at the given index is visible in the viewer.
Parameters:
-
image
Node
_loadImage
-
index
<p>Fires the necessary events to load the requested image.</p>
Parameters:
-
index
Number<p><p>The index of the image to load.</p></p>
_loadVisibleImages
()
protected
Loads all images that are currently visible in the viewer.
_onClickControl
-
event
<p>Fired when one of the viewer's controls is clicked.</p>
Parameters:
-
event
EventFacade
_onClickImage
-
event
Fired when one of the viewer's images is clicked.
Parameters:
-
event
EventFacade
_onCurrentImageReady
()
protected
<p>This should be called when the current image is ready to be displayed.</p>
_onImageClicked
-
event
Fired on the imageClicked
event. Prevents its default behavior when
the widget was scrolled, as the image shouldn't change when dragging.
Parameters:
-
event
EventFacade
_onImageLoad
()
protected
<p>Fired when an image has finished loading.</p>
_onMakeImageVisible
()
protected
Fired on the makeImageVisible
event. It replaces the original logic for
making the image visible through scrolling, using the scroll view for this
instead.
_onMousedown
()
protected
Fired when the mousedown
event is triggered on the widget. Stores
the value of scrollX
at the moment the mousedown happened.
_onResponsive
()
protected
<p>Fired on the <code>responsive</code> event.</p>
_preloadAll
()
protected
<p>Preloads all the images if the <code>preloadAllImages</code> attribute is true.</p>
_renderControls
()
protected
<p>Renders the viewer's controls.</p>
_renderImage
-
index
-
container
<p>Renders the requested image and registers it to be loaded when used.</p>
_renderImageContainers
()
Array
protected
<p>Renders all image containers and returns them in an array.</p>
Returns:
<p><p>list of image containers</p></p>
_renderImageListNode
()
Node
protected
<p>Renders the image list node inside the image viewer.</p>
Returns:
<p><p>the image list node</p></p>
_renderImages
()
protected
<p>Renders the images indicated in the <code>sources</code> attribute.</p>
_renderImagesForFirstTime
()
protected
<p>Renders the images indicated in the <code>sources</code> attribute for the first time. If the images were already present before the widget is rendered, we'll mark these images as having already been loaded.</p>
_setCurrentIndex
-
val
<p>Sets <code>currentIndex</code> attribute.</p>
Parameters:
-
val
Number | String
_setImageAnim
-
val
<p>Sets <code>imageAnim</code> attribute.</p>
Parameters:
-
val
Object
_showCurrentImage
()
protected
<p>Shows the current image in the viewer.</p>
_syncAriaCurrentImageUI
()
protected
<p>Update the aria attributes for image.</p>
_syncControlsUI
()
protected
<p>Updates the controls, showing or hiding them as necessary.</p>
_updateCurrentImageCSS
()
protected
<p>Sets the CSS class that indicates the current image.</p>
bindUI
()
protected
<p>Bind the events for the <code>A.ImageViewerBase</code> UI. Lifecycle.</p>
destructor
()
protected
<p>Destructor implementation for the <code>A.ImageViewerBase</code> class. Lifecycle.</p>
hasNext
()
Boolean
<p>Checks if there is a next element to navigate.</p>
Returns:
hasPrev
()
Boolean
<p>Checks if there is a previous element to navigate.</p>
Returns:
initializer
()
protected
Constructor for the A.ImageViewerMultipleSwipe
. Lifecycle.
initializer
()
protected
Constructor for the A.ImageViewerMultiple
. Lifecycle.
next
()
<p>Loads the next image.</p>
prev
()
<p>Loads the previous image.</p>
renderUI
()
protected
<p>Create the DOM structure for the <code>A.ImageViewerBase</code>. Lifecycle.</p>
updateDimensions
()
Updates the widget's dimensions so that it will fit the page better.
updateDimensionsWithNewRatio
()
Updates the widget's dimensions like the updateDimensions
method, but
also recalculates the ratio to be preserved. Useful if the visible content
of the widget has changed causing the ratio to change as well.
Properties
CSS_PREFIX
String
static
Static property provides a string to identify the CSS prefix.
Attributes
gutter
Array
Vertical and horizontal values in pixels that should not be counted when preserving the widget's ratio. widget.
Default: [0, 0]
imageAnim
Boolean | Object
<p>Configuration attributes passed to the <a href="Anim.html">Anim</a> class, or false if there should be no animation.</p>
Default: Predefined [Anim](Anim.html) configuration.
preloadAllImages
Boolean
<p>Preloads all images listed in the <code>sources</code> attribute.</p>
Default: false
Events
animate
<p>Fired when the current image will be animated in.</p>
imageClicked
Fired when one of the viewer's images was clicked.
makeImageVisible
Fired when the widget needs to make an image visible.
responsive
Fired when the widget will be updated to be responsive.