Skip to content

Instantly share code, notes, and snippets.

@Sysetup
Created July 19, 2016 23:26
Show Gist options
  • Save Sysetup/242c7bb36ed79ce743afaefd7a3b4151 to your computer and use it in GitHub Desktop.
Save Sysetup/242c7bb36ed79ce743afaefd7a3b4151 to your computer and use it in GitHub Desktop.
Loading multiple scripts with $.getScript
$('.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