Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by Avatar Yavor Dashev 4 months, 1 week ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #101794
    Avatar
    tullio0106
    Participant

    Is there any way to use carousel as input ?

    I mean is it possible to have back from a form the selected value of the carousel ?

    Any other way to choose an image ?

    Tks

    #101799
    Avatar
    Yavor Dashev
    Participant

    Hi Tullio,

    I have made yet another code snippet for you which demonstrates how to achieve this functionality.
    In your JS file:

        let carouselItems = document.querySelectorAll('.smart-carousel-item-container'),
            carouselIndicator  = document.querySelectorAll('.smart-indicator');
    
        carousel.addEventListener ('click', ()=>{
            for (let i= 0; i <carouselItems.length; i ++){
                if(carouselIndicator[i].ariaSelected == 'true'){
                    console.log(carouselItems[i].style.backgroundImage)
                }
            }
        })
      

    This will give you the url of the background-image of the currently selected carousel.

    In your HTML file:

    <body>
        <smart-carousel  slide-show interval="2000" loop></smart-carousel>
    	<!-- scripts -->  
        <script type="module" src="../../../source/modules/smart.carousel.js"></script> 
        <script type="module" src="index.js"></script>	
    </body>

    Let me know if that works for you!

    Please, do not hesitate to contact us if you have any additional questions.

    Best regards,
    Yavor Dashev

    Smart UI Team
    https://www.htmlelements.com/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.