Skip to content

Instantly share code, notes, and snippets.

View C-Lodder's full-sized avatar
🏎️

Lodder C-Lodder

🏎️
View GitHub Profile
@C-Lodder
C-Lodder / lazyload.js
Created July 31, 2019 08:08
Lazy load JS
const scripts = [
'https://some-cdn.com/file.js',
'js/file1.min.js',
'js/file1.min.js',
];
scripts.forEach(file => {
const script = document.body.appendChild(document.createElement('script'));
script.async = false;
script.src = file;
@C-Lodder
C-Lodder / calc-rem.js
Created April 10, 2018 14:03 — forked from daniellmb/calc-rem.js
PX-to-REM Calculator
(function($) {
var result = $('#result');
var base = $('#base');
var list = $('#list');
$('#calc').click(function() {
var baseVal = base.val();
var px = list.val().split(',');
var html = [];
$.each(px, function(i, v) {
var px = parseInt(v);
@C-Lodder
C-Lodder / tabs-state-uncompressed.js
Last active May 3, 2017 11:18
Tabstate in vanilla JS
/**
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
/**
* JavaScript behavior to allow selected tab to be remained after save or page reload
* keeping state in sessionStorage with better handling of multiple tab widgets per page
* and not saving the state if there is no id in the url (like on the CREATE page of content)
*/