html - Real time agenda with javascript and json -
i have div on website needs real time agenda list of events. have events loaded through json file , using javascript populate div data file.
the problem data displays stacked item item in 1 column within div, need split div 3 separate columns/divs. 1 events happening now, next, , coming soon. ex) 1 event @ 7am, next 7:30, , coming 8am.
but not able select each item , move using css since code populates 1 item upon page load , cannot see index each item (video side content item) on , on display events necessary.
this lot easier if format items being populated 3 separate columns through css, can't figure out how this.
by way site written using flexbox, hence why there "row" in 1 of divs.
also can please point in right direction how real time? or other helpful solution achieve this?
thanks in advance help.
function populate data
function agendarealtimeupdate() { if ($('.real-time-agenda').length !== 0) { videosidecontenttype = 'agenda'; $.getjson("ac.json", function(data) { var sessions = data.session; var contentstring = ''; var currentsessionindex; var currentsession; var currenttime; var currentday; var title; var time; var room; var description; var d; var = 0; d = new date(); //gets current time , returns in string 3-4 digits ex: "1000" = 10 currenttime = parseint(d.gethours().tostring() + ((d.getminutes() < 10 ? '0' : '') + d.getminutes()).tostring()); currentday = d.getdate(); // loop runs long haven't figured out session matches time while (currentsessionindex === undefined && < sessions.length) { //this takes current time , compares sessions start , end times if ((currenttime >= sessions[i].starttime && currenttime <= sessions[i].endtime) && currentday === sessions[i].day && sessions[i].track === "none") { currentsessionindex = i; } i++; } if (currentsessionindex === undefined) { currentsessionindex = 0; } // function finds sessions come after identified current session function findnextsessions() { var sessionscopy = sessions.slice(); //make copy of sessions array aren't altering when remove indexes (var z = 0; z < 2; z++) { var index = currentsessionindex + z; // breaks out of loop if next session undefined if (sessionscopy[index] === undefined) { z = 2; } currentsession = sessionscopy[index]; // loops through sessions , if session has track removed sessionscopy array while (currentsession.track !== "none") { console.log('has track: ' + currentsession.track); sessionscopy.splice(index, 1); currentsession = sessionscopy[index]; } time = currentsession.timestring !== undefined ? "<div class='video-side-content__time'><b>time:</b> " + currentsession.timestring + "</div>" : ''; room = currentsession.room !== undefined ? "<div class='video-side-content__room'><b>room:</b> " + currentsession.room + "</div>" : ''; title = currentsession.title !== undefined ? "<div class='video-side-content__secondary-title'>" + currentsession.title + "</div>" : ''; description = currentsession.content !== undefined ? "<div class='video-side-content__content'>" + currentsession.content + "</div>" : ''; contentstring += "<div class='video-side-content__item'>" + time + room + title + description + "</div>"; } } findnextsessions(); $('.real-time-agenda').html(contentstring); }); } }
div i'm working with
<div class="row__item"> <h2 class="video-side-content__title"><img src="img/agenda-icon.png"> thursday. sept. 22</h2> <div class="row__flex-container"> <div class="row__item video-side-content__strip video-side-content__strip-left"> </div> <div class="row__item video-side-content__row"> <div class="video-side-content"> <div class="video-side-content__items"> <div class="video-side-content__item"> <h2 class="count-down__sub-header"><br> showing now</h2><br> <div class="real-time-agenda"> <!--data populates upon page load json file lays data out as: time, title, room, description--> </div> <br> </div> </div> </div> </div> </div> </div>
Comments
Post a Comment