Skip to Content

Setting active image in carousel

Hi All,

I have a carousel in my View like below  and I have 4 images to be displayed in the carousel and have each of them as html divs.

I am able to set the images for the carousel dynamically by getting the ids of the html and doing a htmlid.innerhtml =. This works fine.

Now I need to set the active page as image2. I tried using carouselId.setActivePage("img2"). But this didnt work. Any help? Thanks

<Carousel id="carouselId" >


  <html:div id="img1"></html:div>

  <html:div id="img2"> </html:div>

  <html:div id="img3"></html:div>

  <html:div id="img4"></html:div>




Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Dec 31, 2014 at 10:51 AM

    It maybe due to the reason that xml views generates id's prefixed with the root controls. As an alternative of going with id's, you can retrieve the instance of the appropriate control you want to set as ActivePage. To set the img2 as ActivePage you can do,

    var page2 = carousel.getPages()[1];


    Add comment
    10|10000 characters needed characters exceeded