I want to have a quick solution. I am not good at backbone.js so I am getting little trouble here.

Here is my code: https://pastebin.com/KB4vhkkY

I have made a widget for Elementor for a bootstrap carousel.

I have created a repeater field and looped through each of them to display slider. (Line: 188)

Bootstrap carousel need one 'active' class in item so I have created a var $i and put 'active' class if the value of $i is 1 within foreach loop (Line: 189) and increment it.

For front-end it's working fine but in back end rendering all items have 'active' class so it's not working as expected because you can see I don't know how to do foreach in backbone.js in Line 223.

Another problem is, in Line 182 you can see there are bootstrap carousel indicators. these indicators are static right now. How can I make them dynamic just like 'active' class in items.

Hope I made you understand what I am trying to say. please suggest me good solution.

Thanks in advance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.