javascript - Bootstrap Carousel interval alteration -
I have a website that uses bootstrap carousel Here's my code:
& Lt; Div id = "slider" & gt; & Lt; Div id = "carousel-bounding-box" & gt; & Lt; Div class = "carousel slide" id = "mycarousel" & gt; & Lt; Div class = "carousel-interior" & gt; & Lt ;? Php if ($ images = get_field ('image', $ design_id)) {foreach ($ image => image as the key of $) {$ active = $ key == 0? 'Active': ''; Echo 'item' data-interval = "1000" & gt; '; Echo '& lt; Img src = "'$ image [' image '] [' size '] [' big ']' 'echo' '/ div & gt;';}}? & Gt; & lt; / div & gt; & Lt; a class = "left carousel-control" href = "# myCarousel" role = "button" data-slide = "back" gt; & lt; span class = "glyphicon glyphicon-chevron-left" & gt; Lt; / span & gt; & lt; / a & gt; & lt; a class = "right carousel-control" href = "# myCarousel" role = "button" data-slide = "next" & gt; ; Span class = "glyphicon glyphicon-chevron-right"> & lt; / Div> This is my jQuery:
jQuery (document) .ready (function ($) {$ ('# myCarousel'). Carousel ($ {Interval: 1000}); $ ('# carousel -text ') .HTML ($ (' # slide-content-0 '). Html ()); // Carousel thumbnail $ (' [id = hindola-selector -] '). Click (function () { Var id_selector = $ (this) .attr ("id"); var id = id_selector.substr (id_selector.length -1); var id = parseInt (id); $ ('#MyCarousel') carousel (id).} ); // When updating the carousel slides, auto $ $ ('# myCarousel') text. ('Slid.bs.carousel', function (e) {var id = $ ('Item.active'). Data ('slide number'); $ ('# hindola-lesson'). Html ($ (' # Slide-content- '+ ID) .html ());}); (Function ($) {fakewaffle.responsiveTabs (['xs', 'sm']);}); });
I changed the interval: Interval from 5000: 1000 because there is a delay when the slider loads the item when the page loads. Sliders are loaded completely and quickly, changing the interval from 1000, but now the slide items need to be slower because they are faster between slides.
I think the problem is "active" state, a slide / image has not been given after the interval
Any help would be greatly appreciated
< / Div>
The code used to fix is:
jquery (document) .ready (function ($) {$ ('# MyCarousel'). Carousel ({interval: 3000}); $ ('# MyCarousel .item: first'). AddClass ('active');});
Comments
Post a Comment