Created
July 19, 2016 23:26
-
-
Save Sysetup/242c7bb36ed79ce743afaefd7a3b4151 to your computer and use it in GitHub Desktop.
Loading multiple scripts with $.getScript
This file contains 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
$('.main-content').load('includes/home.html',function(){ | |
$.when( | |
$.getScript("assets/plugins/parallax-slider/js/modernizr.js"), | |
$.getScript("assets/plugins/parallax-slider/js/jquery.cslider.js"), | |
$.getScript("assets/js/plugins/parallax-slider.js"), | |
$.Deferred(function( deferred ){ | |
$( deferred.resolve ); | |
}) | |
).done(function(){ | |
App.init(); | |
OwlCarousel.initOwlCarousel(); | |
StyleSwitcher.initStyleSwitcher(); | |
ParallaxSlider.initParallaxSlider(); | |
}); | |
}); | |
////////// | |
$('.main-content').load(page + '.html', function(){ | |
$.getScript("assets/plugins/parallax-slider/js/modernizr.js", function(){ | |
$.getScript("assets/plugins/parallax-slider/js/jquery.cslider.js", function(){ | |
$.getScript("assets/js/plugins/parallax-slider.js", function(){ | |
App.init(); | |
OwlCarousel.initOwlCarousel(); | |
StyleSwitcher.initStyleSwitcher(); | |
ParallaxSlider.initParallaxSlider(); | |
}); | |
}); | |
}); | |
$('.main-content').fadeIn('slow'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment