ReplaceWith carousel-inner with new items

2019-07-24 20:14发布

问题:

Community :-)

this is my first Question. There are similar but I have a very special problem. I try to change the items of an bootstrap carousel on demand - but it frozes after that. If I do, it shows the first active but I cannot use the slide buttons and indicators. I the Demo I have triggered the replacement with setTimeout 10 Seconds. So you can see 10 Seconds the static coded items and after that it will be replaced by JQuery ReplaceWith.

Is there a refresh command or similar ?

回答1:

I tested with your linked code and figured out you have to replaceWith the hole

< div class="view">

including the carousel-control links. Also I replaced the #carousel-363119 in your for loop.

That way jquery works like we add a hole new carousel.