Skip to content

Instantly share code, notes, and snippets.

@vielhuber
Last active September 22, 2017 23:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vielhuber/6900613a27ecdaf8d4752139263491bf to your computer and use it in GitHub Desktop.
Save vielhuber/6900613a27ecdaf8d4752139263491bf to your computer and use it in GitHub Desktop.
localhost auto reload .css on mobile #js
$(document).ready(function() {
if( $(window).width() < 1200 && $('.localhost').length > 0 ) {
var path_1 = $('head link[href*="style.css"]').attr('href');
var path_2 = $('head link[href*="px2rem.css"]').attr('href');
setInterval(function() {
$('head link[href*="style.css"]').attr('href',path_1+'?rand='+(~~(Math.random()*999)+100));
$('head link[href*="px2rem.css"]').attr('href',path_2+'?rand='+(~~(Math.random()*999)+100));
}, 5000);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment