2016-11-13 65 views
0

如何在5秒後更改我的頁面背景圖片? 我正在考慮使用twitter引導使用旋轉木馬。但是我迄今看到的每個例子都是在按下下一個按鈕時更改圖像。如何在5分鐘後在asp.net + bootstrap中自動更改背景照片

最好做什麼?我應該只關注asp.net和css文件來做到這一點?和C#後面的代碼,或添加JavaScript或jQuery?

+0

請檢查下面提供的樣品 – Aruna

回答

0

您可以使用引導carouseldata-interval="5000"設置時間,其中5000milli seconds等於5 seconds

Smaple代碼:

<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 for slides --> 
 
    <div class="carousel-inner"> 
 
    <div class="item active"> 
 
     <img src="http://placehold.it/1200x315" alt="..."> 
 
     <div class="carousel-caption"> 
 
     \t <h3>Caption Text</h3> 
 
     </div> 
 
    </div> 
 
    <div class="item"> 
 
     <img src="http://placehold.it/1200x315" alt="..."> 
 
     <div class="carousel-caption"> 
 
     \t <h3>Caption Text</h3> 
 
     </div> 
 
    </div> 
 
    <div class="item"> 
 
     <img src="http://placehold.it/1200x315" alt="..."> 
 
     <div class="carousel-caption"> 
 
     \t <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 -->