Skip to content

Instantly share code, notes, and snippets.

@smartdeal
Last active February 1, 2018 10:45
Show Gist options
  • Save smartdeal/bdbcc4cb2f11d8831c22ff20e6e12d74 to your computer and use it in GitHub Desktop.
Save smartdeal/bdbcc4cb2f11d8831c22ff20e6e12d74 to your computer and use it in GitHub Desktop.
[Загрузка скриптов и стилей потом] #Javascript
$(document).ready(function(){
jQuery.loadScript = function (url, callback) {jQuery.ajax({url: url, dataType: 'script', success: callback, async: true }); }
// Usage
// if (typeof someObject == 'undefined') $.loadScript('url_to_someScript.js', function(){
// Stuff to do after someScript has loaded
// });
function loadCSS(url) {$("<link/>", {rel: "stylesheet",type: "text/css",href: url}).appendTo("head");}
// Usage
// loadCSS(theme_url + '/js/slick/slick.css');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment