javascript - How to program next div automatically after 5 seconds -
i'm developing new website , need change frame after 7 seconds. idea first frame, after 7 secs frame 2, , after 7 secs frame 3 has button proceed.
can me out that?
the code have far is:
<header id="home"> <div id="home-slider" class="carousel slide carousel-fade" data-ride="carousel"> <div class="carousel-inner"> <div class="item active" style="background-image: url(images/slider/1.jpg)"> <div class="caption"> <h1 class="animated fadeinleftbig">bem vindo </div> </div> <div class="item" style="background-image: url(images/slider/2.jpg)"> <div class="caption" <h1 class="animated fadeinleftbig">nÓs somos </h1> </div> </div> <div class="item" style="background-image: url(images/slider/3.jpg)"> <div class="caption"> <h1 class="animated fadeinleftbig"> <span>the outsider marketing company</span></h1> <p class="animated fadeinrightbig">marketing - comunicaÇÃo - webdesign</p> <a data-scroll class="btn btn-start animated fadeinupbig" href="#services">prosseguir</a> </div> </div> </div> <a class="left-control" href="#home-slider" data-slide="prev"><i class="fa fa-angle-left"></i></a> <a class="right-control" href="#home-slider" data-slide="next"><i class="fa fa-angle-right"></i></a> <a id="tohash" href="#services"><i class="fa fa-angle-down"></i></a>
i guess want through jquery, must have item class rule display: none
, active display:block
, try code:
$(document).ready(function(){ var currentitem = 0, items = $('.item'); settimeout(function(){ items.removeclass('active'); items[currentitem].addclass('active'); if(currentitem == items.lenght - 1) currentitem = 0; }, 7000) });
Comments
Post a Comment