I have a custom made slideshow object to perform the usual stuff the name indicates on a website. It all works well except when I switch tabs in Chrome and come back to the
There was a similar problem with chrome
As I have solved this problem. At the start, write down mktime variable, and then simply subtracted from the current time. Example:
var values = {};
function mktime(){
var date = new Date();
return Math.floor(date.getTime()/1000);
}
function getTime(string){
var splitContent = string.split(/\:/g);
var hours = parseInt(splitContent[0]) * 60 * 60;
var minutes = parseInt(splitContent[1]) * 60;
var seconds = parseInt(splitContent[2]);
return hours + minutes + seconds;
}
function startTimer(time){
values.startMkTime = mktime();
values.startTime = getTime(time);
setInterval(process(),1000);
}
function process(){
values.currentTime = (mktime() - values.startMkTime) + o.values.startTime;//new code
}