Last active
February 1, 2018 10:45
-
-
Save smartdeal/bdbcc4cb2f11d8831c22ff20e6e12d74 to your computer and use it in GitHub Desktop.
[Загрузка скриптов и стилей потом] #Javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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