2017-06-14 242 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(); 
    } 
});