Enabling auto-scrolling in the Content Carousel widget
You might want the Content Carousel widget to automatically scroll through the images rather than requiring the user to control the scrolling. If so, you can add an auto-scrolling property to the UI provider JSPF file for the widget and specify the scrolling speed.
With this feature enabled, the widget auto-scrolls until the shopper interacts with the widget, for example, by clicking an image or by using the arrows for scrolling.
Note: The following steps are applicable only if you are using the Dojo framework.
Before you begin
About this task
Procedure
- Start HCL Commerce Developer. Switch to the Enterprise Explorer view.
-
Open your custom ContentCarousel_UI.jspf file for the Content Carousel
widget.
Tip: For the default widget, the file is at the following path:
- workspace_dir\Stores\WebContent\widgetdir\com.ibm.commerce.store.widgets.ContentCarousel
-
Find the following line of code:
<div id="contentCarouselWidget${widgetSuffix}" class="contentCarouselWidget carousel" data-dojo-type="wc/widget/Carousel" data-dojo-props="speed:2000" >
-
Add the following value to the data-dojo-props attribute:
,auto:5000
The result looks like this example
<div id="contentCarouselWidget${widgetSuffix}" class="contentCarouselWidget carousel" data-dojo-type="wc/widget/Carousel" data-dojo-props="speed:2000,auto:5000" >
Tip: The number5000
specifies the number of milliseconds between each scroll, which means the widget will scroll every 5 seconds. You can use a different number to shorten or lengthen the time. - Save and close the ContentCarousel_UI.jspf file.