Skip to content

Instantly share code, notes, and snippets.

@ollien
Created January 22, 2015 06:43
Show Gist options
  • Save ollien/2ac102422fe0d101bd8f to your computer and use it in GitHub Desktop.
Save ollien/2ac102422fe0d101bd8f to your computer and use it in GitHub Desktop.
Convert CSS transition-duration to ms
function timeStringtoTime(s){
if (s.indexOf('ms')!=-1){
var result = s.replace('ms','');
console.log(result);
return parseInt(result);
}
else{
var result = s.replace('s','');
return parseFloat(result)*1000;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment