javascript - How to make background photo change automatically after 5 seconds in asp.net + bootstrap -
how can background pic of page change after 5 seconds? thinking use carousel twitter bootstrap. every example i've seen far change image when press next button.
what best it? should focus asp.net , css file make this? , code behind on c#, or add javascript or jquery?
you can use bootstrap carousel
data-interval="5000"
set time 5000
in milli seconds
equals 5 seconds
.
smaple code:
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <div id="carousel-example-generic" class="carousel slide" data-ride="carousel" data-interval="5000"> <!-- indicators --> <ol class="carousel-indicators"> <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li> <li data-target="#carousel-example-generic" data-slide-to="1"></li> <li data-target="#carousel-example-generic" data-slide-to="2"></li> </ol> <!-- wrapper slides --> <div class="carousel-inner"> <div class="item active"> <img src="http://placehold.it/1200x315" alt="..."> <div class="carousel-caption"> <h3>caption text</h3> </div> </div> <div class="item"> <img src="http://placehold.it/1200x315" alt="..."> <div class="carousel-caption"> <h3>caption text</h3> </div> </div> <div class="item"> <img src="http://placehold.it/1200x315" alt="..."> <div class="carousel-caption"> <h3>caption text</h3> </div> </div> </div> <!-- controls --> <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left"></span> </a> <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next"> <span class="glyphicon glyphicon-chevron-right"></span> </a> </div> <!-- carousel -->
Comments
Post a Comment