Custom Carousel/Slider component using Sightly | Community
Skip to main content
au4liferz
Level 4
Oct 16, 2015 2:28 AM UTC
Solved

Custom Carousel/Slider component using Sightly

I have a requirement to develop a custom carousel using Sightly, but there really isn't a lot of documentation out there, and I'm not sure where to start, or exactly how to go about it. There are several good javascript carousel/slider components, and I'm wondering if I should try to use one of them, or simply develop it from scratch using Java/JSP. If anyone can summarize the steps, provide tutorials orany other links and material you can share, it would be greatly appreciated. The most important thing is to develop this component in a manner that embodies best practices such as a good separation of presentation and business logic, (MVC'ish architecture), and loose coupling from a styling perspective.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Lokesh_Shivalingaiah
Lokesh_ShivalingaiahAccepted solution
Level 10
Oct 16, 2015 2:28 AM UTC

Refer [1] to create a sightly template and read values from the dialog 

[1] https://helpx.adobe.com/experience-manager/using/creating-sightly-component.html

Refer [2] for multiple taglibs available in Sightly. It helps you to in #2 to loop through all the images and create div

[2] https://docs.adobe.com/docs/en/aem/6-0/develop/sightly.html

For #3, once you have read the values and created div, apply JS to get the carousel running.

14 replies

Level 2
Jun 5, 2018 6:43 AM UTC

But i was wondering how to make We.retail or OOTB carousel component work ?
can it  be made work , is there any documentation for the same ?

Translate
smacdonald2008
Level 10
Jun 4, 2018 3:02 PM UTC

Using Bootstrap carousel component works nicely in AEM: https://getbootstrap.com/docs/4.0/components/carousel/

Translate
Level 2
Jun 4, 2018 2:40 PM UTC

Is there any OOTB working carousel component present in AEM which we could leverage ?
i did found carousel component present in We.Retail , but on using that component , it wasn't working as i expected to work.
Could you confirm, whether its working or not ? 

Translate
smacdonald2008
Level 10
Oct 16, 2015 2:28 AM UTC

Can I ask why use Sightly - not JSP? 

There are a lot of good plug-ins available that will let you use JS libs to achieve this use case. For example: 

https://helpx.adobe.com/experience-manager/using/custom-carousel-components.html

Translate
edubey
Level 10
Oct 16, 2015 2:28 AM UTC

Hi, 

This is simple, no need to get too much serious

1. First, With any slider / carousel available on internet, you get HTML + CSS + JS, get all these 3 thing and put in your code. Simple one is here @ http://www.w3schools.com/bootstrap/bootstrap_carousel.asp

2. Make a dialog where user can author these images and captions.

Translate
Feike_Visser1
Employee
Oct 16, 2015 2:28 AM UTC

I would normally start with the HTML/markup, and then adding logic where needed.\

When using Sightly the logic can reside in either Java or Javascript, but not mixed in the markup.

Translate
au4liferz
au4liferzAuthor
Level 4
Oct 16, 2015 2:28 AM UTC

Would someone please help? What are the steps needed to try and do this component using Sightly??? Thanks in advance.

Translate
au4liferz
au4liferzAuthor
Level 4
Oct 16, 2015 2:28 AM UTC

So Feike, (or really, anyone who can provide an answer), are you saying that I would develop my function in JSP or JS, (e.g. a function to build <div>'s and <ul>'s and <li>'s based on the number of items I'm storing in the carousel), and then call them from Sightly??? I have gotten a JS plugin component working using static HTML, (i.e. the slick plugin), but I need to be able to get the properties from the AEM dialog, and dynamically create the HTML required for the number of items the author wants to display in the carousel. I can do this using JSP, mixed with some static HTML, but it's very ugly, (i.e. harder to read), and it's also tough because I have to instantiate different "slick" funtions based on the options that the author chooses from the AEM dialog, (e.g. when they want to display 4 slides instead of one, or when they want a responsive carousel etc.).

I'm also having a LOT of trouble implementing simple radio buttons, and having them register as true or false, based on whether the author selects the radio button. Also, once the radio is clicked, it doesn't seem that you can click it again, and deselect it. If any of you can help with these items and provide code samples, I would really, really appreciate it.

Translate
au4liferz
au4liferzAuthor
Level 4
Oct 16, 2015 2:28 AM UTC

Thanks to both of you for the responses. I hope the Sightly documentation on the Adobe site is enough for me to use the base component you linked to get this done. Hopefully, I can find most of the core functionality/logic in existing javascript libs.

Translate
Lokesh_Shivalingaiah
Lokesh_ShivalingaiahAccepted solution
Level 10
Oct 16, 2015 2:28 AM UTC

Refer [1] to create a sightly template and read values from the dialog 

[1] https://helpx.adobe.com/experience-manager/using/creating-sightly-component.html

Refer [2] for multiple taglibs available in Sightly. It helps you to in #2 to loop through all the images and create div

[2] https://docs.adobe.com/docs/en/aem/6-0/develop/sightly.html

For #3, once you have read the values and created div, apply JS to get the carousel running.

Translate