$(document).ready(function() { var screenWidth = $(window).width(); if(screenWidth<=767) { suanyayinda(true,true); } else { suanyayinda(false,true); } }); $(window).resize(function () { if($(window).width()<=767) { suanyayinda(true,false); } }); function suanyayinda(scroolRun,resizeScreen) { //degiskenler var curruntTime, lastTime, timeIndex, datetime, getCurruntTime, lastdiv, mobilDiv, lastDiv; //Su an yayinda ekleniyor $('.sched-container .sched-cell').each(function () { timeIndex = $(this).index(); curruntTime = parseInt($('.time', this).html().replace(':', '').substring(0, 4)); lastdiv = $('.sched-container .sched-cell').eq(timeIndex - 1); mobilDiv = $('#diyanet_tab .sched-row').eq(timeIndex - 1); lastdiv.each(function () { lastTime = parseInt($('.time', this).html().replace(':', '').substring(0, 4)); }); datetime = new Date(); getCurruntTime = parseInt(datetime.getHours() + '' + (datetime.getMinutes().toString().length > 1 ? datetime.getMinutes() :'0'+ datetime.getMinutes())); if ((curruntTime >= getCurruntTime && lastTime < getCurruntTime)) { if(resizeScreen) { lastdiv.find('a').prepend("
Şu an yayında
") mobilDiv.find('a').append("
Şu an yayında
") lastdiv.find('a .time').css('margin-top', '0px'); } if(scroolRun) { var container = document.querySelector('.tab-pane'); container.scrollTop = timeIndex*($('.sched-row').height()+40); } } }); }