I'm trying to make an EPG which is supposed to update automatically when the current time reaches the "endtime".
My code basically looks something like this... sorry 'bout the ugly markup.
<span class="channel">
<span class="channum">01</span>
TV1
</span>
<span id="tv1" class="showing">
<span class="starttime">22:30</span>
Program Title
<span class="progresscontainer">
<span class="progressbar" style="width:50%"></span>
</span>
<br />
<span class="endtime">23:00</span> Program Title
</span>
<span class="channel">
<span class="channum">02</span>
TV2
</span>
<span id="tv2" class="showing">
<span class="starttime">22:15</span>
Program Title
<span class="progresscontainer">
<span class="progressbar" style="width:0%"></span>
</span>
<br />
<span class="endtime">23:30</span>
Program Title
</span>
<span class="channel">
<span class="channum">03</span>
TV3
</span>
<span id="tv3" class="showing">
<span class="starttime">21:45</span>
Program Title
<span class="progresscontainer">
<span class="progressbar" style="width:75%"></span>
</span>
<br />
<span class="endtime">22:30</span>
Program Title
</span>
How do you compare the time inside <span class="endtime">
with the current time and load the content from tv1.php
tv2.php
and tv3.php
into the respective <span>
's with the corresponding id
's?
I'm not that strong in jquery so this is all I have so far.
$(document).ready(function() {
var d = new Date();
var hh = d.getHours();
var mm = d.getMinutes();
if (hh < 10) {hh = '0' + hh;}
if (mm < 10) {mm = '0' + mm;}
var time = hh + ':' + mm;
$('.showing').each(function(){
var epg = $(this).attr('id') + '.php';
$(this).load(epg);
});
});
Hope someone can help me out.