2017-06-14 75 views
-2

jQuery對象移動我有一個時間表欄像下面在時間軸

<div class="plan-bar main-gradient"></div> 

timeline bar

現在我該怎樣做紅框移動上實時基地? 感謝您的閱讀。

+0

「realtime」是什麼意思? – squgeim

+0

基於系統日期時間先生 – user3688221

+0

你試過了什麼?你可以發佈你的代碼嗎? – karthick

回答

0

我有這個工作很好,權利here。謝謝大家。

function update() { 
var wB = 600; 
var wA = 0; 
var hours = new Date().getHours(); 

var d = 20; 
var total_d = 20 
pos_rad = ((d)*24 + hours)/((total_d)*24.00); 

xCoord = (wA) + wB*pos_rad; 
$(".Box").css({ 
    "left": xCoord 
}); 
setTimeout(function(){ update(); }, 1000); 
} 

$(function(){ 
    var today=new Date(); 
    var dd = today.getDate(); 
    var mm = today.getMonth()+1; 
    if (dd==14 && mm==6) { 
    update(); 
    } 
});