Class s7sdk.set.InteractiveThumbnailGridView
The InteractiveThumbnailGridView
component is used to render the list of swatches that are associated
with interactive actions.
The following modifiers are supported:
Modifier | Syntax | Description | Default |
serverurl | isRootPath | The Image Serving root path. If no domain is specified, the domain from which the page is served is applied instead. Standard URI path resolution applies. | /is/image/ |
iscommand | value | The Image Serving command string that is applied to all thumbnails. If specified in the URL, all occurrences of '&' and '=' must be HTTP-encoded as %26 and %3D , respectively. | "" |
maxloadradius | -1|0|preloadnbr | Specifies the component preload behavior. When set to -1 , all thumbnails are loaded simultaneously when the component is initialized or the asset has changed. When set to 0 , only visible thumbnails are loaded. Set preloadnbr to define how many invisible rows and columns are preloaded around the visible area. | 1 |
direction | auto|left|right | Specifies the way thumbnails fill in the view. Set left so that the view is filled in a left-to-right order. Set right to reverse the order so that the view is filled in from a right-to-left, top-to-bottom direction. Set auto so the component applies right mode when locale is set to "ja". Otherwise, left is used. | auto |
textpos | bottom|top|left|right|none|tooltip | Specifies where the label is drawn relative to the thumbnail image. That is, the label is centered at the specified location relative to the thumbnail. When tooltip is specified, no label is drawn. | bottom |
fmt | jpg|jpeg|png|png-alpha|gif|gif-alpha | Specifies the image format that the component uses for loading images from Image Server. Use any image format value that is supported by Image Server and the client browser. If the image format ends with "-alpha", the component renders images as transparent. For all other image format values, the component treats images as opaque. | jpeg |
align | left|center|right | Specifies the internal horizontal alignment--or anchoring--of the thumbnails container within the component area. In InteractiveThumbnailGridView , the internal thumbnail container is sized so that only a whole number of thumbnails is shown. As a result, there is some padding between the internal container and the external component bounds. This modifier specifies how the internal thumbnails container is positioned horizontally inside the component. | center |
enabledragging | 0|1[,overdragvalue] | Enables or disables the ability for a user to scroll the thumbnails using a mouse or using touch gestures. Set overdragvalue to set a percent value for movement in the wrong direction of the actual speed. The range is 0 - 1. If set to 1, it moves with the mouse. If set to 0 it does not let you move in the wrong direction at all. | 1,0.5 |
scrollbar | 0|1 | Enable the use of the scroll bar. | 1 |
Defining the Appearance using CSS
You can define the appearance of the InteractiveThumbnailGridView
component using CSS rules. All HTML5 Viewer SDK components use class selectors for styling. You can style the body of the InteractiveThumbnailGridView
component by using
the .s7interactivethumbnailgridview
class selector. The styles that are associated with this class selector are applied to all instances of the InteractiveThumbnailGridView
component. You can style particular instances by prefixing
the class rule with the instance #id. For example, styling rules for #myComp.s7interactivethumbnailgridview
are applied only to the particular InteractiveThumbnailGridView
instance.
The styling of the sub-elements using class selectors like .s7thumb
for example, must be specified in the form of the descendant class selectors, that is,
they must follow the main class selector separated by a space, such as .s7interactivethumbnailgridview .s7thumb
.
For more information on component styling see the HTML5 Viewer SDK User Guide and the default styles section.
CSS Class | Attribute Selector | Description |
.s7interactivethumbnailgridview | (None) | Represents the main body of the InteractiveThumbnailGridView component; it is possible to define size, position and outer borders. |
.s7thumbcell | (None) | Defines thumbnail spacing using margin CSS property. |
.s7thumb | state=[default|selected|over] | Defines the appearance of the thumbnail. The height and width properties will define the dimensions of the thumb. It is possible to apply different borders for different values of state attribute to implement "active" highlight. default value of state attribute corresponds to "up" state, selected means that the thumbnail is currently selected and over state turns on when user rolls over unselected thumbnail. |
.s7label | (None) | Defines the appearance of the thumbnail labels. |
.s7tooltip | (None) | A global class selector that defines appearance for the tooltips. To disable tooltips set the display style to none . |
.s7scrollbar | (None) | Defines the size and appearance of the scrollbar. The width is controlled by the width property. The height by default is the same as InteractiveThumbnailGridView height, however it is possible to it using top , bottom or height properties. Adjusting horizontal scrollbar position within InteractiveThumbnailGridView using left or right properties is not supported. |
.s7scrollthumb | state=[up|over|down] | Defines the appearance of the scrollbars thumb. Thumb size is controlled with width and height properties. Horizontal alignment can be adjusted using left property, which sets thumb position within scroll bar container. Any value set for top property will be ignored and overridden by the scroll bar logic |
.s7scrolltrack | (None) | Defines the appearance of the scrollbars track. It is possible to set the width and horizontal offset inside scroll bar area. The height of scroll track is automatically set to fill the space between top and bottom scroll buttons, setting custom scroll track height is not supported. |
.s7scrollupbutton | state=[up|over|down|disabled] | Defines the appearance of the scroll bar "up" button. Button can be styled just like any other SDK button. It is possible to set horizontal and/or vertical offset within scroll bar area using left , right or top properties. |
.s7scrolldownbutton | state=[up|over|down|disabled] | Defines the appearance of the scroll bar "down" button. Button can be styled just like any other SDK button. It is possible to set horizontal and/or vertical offset within scroll bar area using left , right or top properties. |
Localizable Symbols
InteractiveThumbnailGridView also have a number of text symbols that you can localize either in a preset or in the viewer page though the mechanisms
provided by the ParameterManager
. For more information on localization consult the ParameterManager
API documentation and HTML5 Viewers SDK User Guide.
Symbol | Description |
ScrollUpButton.TOOLTIP | Define a localized tooltip of ScrollUpButton |
ScrollDownButton.TOOLTIP | Define a localized tooltip of ScrollDownButton |
Constructor Attributes | Constructor Name and Description |
---|---|
s7sdk.set.InteractiveThumbnailGridView(container, settings, compId)
|
Method Attributes | Method Name and Description |
---|---|
addEventListener(type, handler, useCapture)
Adds an event listener to the instance of the
InteractiveThumbnailGridView component. |
|
dispose()
Dispose is used to remove itself and all sub-elements from the DOM
|
|
Returns the current inner height of the component.
|
|
Returns currently displayed list of interactive swatches.
|
|
Get the global properties of the interactive data associated with the currently
displayed list of interactive swatches.
|
|
getWidth()
Returns the current inner width of the component.
|
|
resize(w, h)
Resize the component.
|
|
setCSS(classname, property, value)
Sets a particular CSS class and property on a component
|
|
setInteractiveData(interactiveData, properties)
Changes the currently displayed list of interactive swatches by providing an array of interactive data.
|
|
setModifier(modObj)
Sets 1-N # of modifiers for the component.
|
Default styles for InteractiveThumbnailGridView:.s7interactivethumbnailgridview { background-color:rgba(100, 100, 100, 0.2); position:absolute; user-select:none; -ms-user-select:none; -moz-user-select:-moz-none; -webkit-user-select:none; -webkit-tap-highlight-color:rgba(0,0,0,0); width:500px; height:250px; } .s7interactivethumbnailgridview .s7thumbcell { margin:5px; } .s7interactivethumbnailgridview .s7thumb { border:1px solid transparent; width:75px; height:75px; } .s7interactivethumbnailgridview .s7thumb[state='selected'] { border:1px solid #FFFFFF; } .s7interactivethumbnailgridview .s7label { font-family:Helvetica, sans-serif; font-size:12px; } .s7interactivethumbnailgridview .s7scrollbar { background-color:rgba(100, 100, 100, 0.2); position:absolute; top:0px; bottom:0px; right:0px; width:22px; } .s7interactivethumbnailgridview .s7scrollbar .s7scrollthumb { width:20px; position:absolute; backgroundRepeat:no-repeat; backgroundPosition:center; height:30px; } .s7interactivethumbnailgridview .s7scrollbar .s7scrollthumb[state='up'] { background-image:url(images/sdk/scrollbar_thumb_up.png); } .s7interactivethumbnailgridview .s7scrollbar .s7scrollthumb[state='over'] { background-image:url(images/sdk/scrollbar_thumb_over.png); } .s7interactivethumbnailgridview .s7scrollbar .s7scrollthumb[state='down'] { background-image:url(images/sdk/scrollbar_thumb_down.png); } .s7interactivethumbnailgridview .s7scrollbar .s7scrollthumb[state='disabled'] { background-image:url(images/sdk/scrollbar_thumb_disabled.png); } .s7interactivethumbnailgridview .s7scrollbar .s7scrolltrack { width:20px; background-color:#cbcbcb; } .s7interactivethumbnailgridview .s7scrollbar .s7scrollupbutton { display:block; width:20px; height:20px; } .s7interactivethumbnailgridview .s7scrollbar .s7scrollupbutton[state='up'] { background-image:url(images/sdk/scroll_up_up.png); } .s7interactivethumbnailgridview .s7scrollbar .s7scrollupbutton[state='over'] { background-image:url(images/sdk/scroll_up_over.png); } .s7interactivethumbnailgridview .s7scrollbar .s7scrollupbutton[state='down'] { background-image:url(images/sdk/scroll_up_down.png); } .s7interactivethumbnailgridview .s7scrollbar .s7scrollupbutton[state='disabled'] { background-image:url(images/sdk/scroll_up_disabled.png); } .s7interactivethumbnailgridview .s7scrollbar .s7scrolldownbutton { display:block; width:20px; height:20px; } .s7interactivethumbnailgridview .s7scrollbar .s7scrolldownbutton[state='up'] { background-image:url(images/sdk/scroll_down_up.png); } .s7interactivethumbnailgridview .s7scrollbar .s7scrolldownbutton[state='over'] { background-image:url(images/sdk/scroll_down_over.png); } .s7interactivethumbnailgridview .s7scrollbar .s7scrolldownbutton[state='down'] { background-image:url(images/sdk/scroll_down_down.png); } .s7interactivethumbnailgridview .s7scrollbar .s7scrolldownbutton[state='disabled'] { background-image:url(images/sdk/scroll_down_disabled.png); } .s7tooltip { position:absolute; padding:5px; line-height:100%; text-align:center; background-color:rgb(224, 224, 224); color:rgb(26,26,26); font-family:Helvetica, sans-serif; font-size:11px; z-index:10000; border:1px solid rgb(191,191,191); }
The code below does the following:{zoom/examples/InteractiveThumbnailGridView.html}
- The Scene7 HTML5 SDK is linked to the page and the required s7sdk components are included in the document head.
- CSS Styles are defined in the document head to control the appearance of the SDK components.
- The s7sdk.Util.init() method is called to initialize the SDK.
- A ParameterManager object is created to handle component modifiers for the viewer.
- An initViewer() function is defined. This function initializes a couple of modifiers (hard coded for example purposes), then creates the component objects required for this simple example. The initViewer() function also adds event listeners that designate functions to handle relevant component events (which might be dispatched by the components as a result of user interactions, changes in a component's state, etc.).
- Handler functions are defined to respond to the component event listeners added in the initViewer() function.
- An event listener is added to the ParameterManager object that designates the initViewer() function as the handler to call when the Scene7 SDK is loaded and ready.
- Finally, the init() method is called on the ParameterManager object to start the viewer.
- Parameters:
- {String|Container} container
- The reference to
Container
instance or the ID of the parent DOM element to which the component is added as a child - {s7sdk.ParameterManager} settings
- A parameter manager instance that represents the desired configuration.
- {String} compId
- An optional parameter that specifies the ID of the component DOM element.
InteractiveThumbnailGridView
component. The handler function
receives a DOM event object of type Event
. The object contains a property s7event
,
which references the associated custom event object, for example s7sdk.event.InteractiveSwatchesEvent
.
The events supported by the component are:
s7sdk.event.InteractiveSwatchesEvent.SWATCH_QUICKVIEW_ACTIVATED
- Dispatched when a swatch associated with a QuickView href is selected. s7sdk.event.InteractiveSwatchesEvents7sdk.event.InteractiveSwatchesEvent.SWATCH_URL_ACTIVATED
- Dispatched when a swatch associated with a URL href is selected. This event is dispatched before navigating to the URL.s7sdk.event.InteractiveSwatchesEvents7sdk.event.StatusEvent.NOTF_ASSET_METADATA_READY
- Dispatched when component receives asset metadata. If the component is initialized with setMediaSet()
it dispatches instantly inside that API call. Otherwise if the component loads req=set on its own, this event is sent when component has received and parsed req=set. s7sdk.event.StatusEvents7sdk.event.StatusEvent.NOTF_VIEW_READY
- Dispatched when component loads all images for swatches currently visible on the screen. It is sent both during the initial load and during consequent scroll or resize operations. s7sdk.event.StatusEvents7sdk.event.StatusEvent.NOTF_PRELOAD_START
- Dispatched when swatch images download begins according to maxloadradius
modifier. The event may be sent multiple times during component's life cycle as user actions may trigger new preloading step. s7sdk.event.StatusEvents7sdk.event.StatusEvent.NOTF_PRELOAD_COMPLETE
- Dispatched when all swatch images according to maxloadradius
modifier are downloaded. The event may be sent multiple times during component's life cycle as user actions may trigger new preloading step. s7sdk.event.StatusEvent- Parameters:
- {String} type
- Event name, for example
s7sdk.event.InteractiveSwatchesEvent.SWATCH_URL_ACTIVATED
. - {Function} handler
- Function to be called when the event gets dispatched.
- {Boolean} useCapture
- Register capture phase.
- Returns:
- {Number} the inner height of the component.
- Returns:
- {Array} Array of JSON objects specifying the swatches asset and corresponding actions.
- Returns:
- {Object} JSON objects with name:value pairs.
- Returns:
- {Number} the inner width of the component.
- Parameters:
- {Number} w
- width in pixels.
- {Number} h
- height in pixels.
- Parameters:
- {String} classname
- The CSS classname to use for this style. i.e. .s7interactivethumbnailgridview
- {String} property
- The CSS property that is being set. i.e. background-color
- {String} value
- The CSS property value being set. i.e. #FF0000
- Parameters:
- {Array} interactiveData
- Array of JSON objects specifying the swatches asset and the corresponding actions.
- {Object} properties
- Optional JSON object specifying global interactive data properties
- Parameters:
- {Object} modObj
- A simple JSON object with name:value pairs of valid modifiers for a particular component