Skip to content

Instantly share code, notes, and snippets.

@bradyvercher
Last active August 29, 2015 13:58
Show Gist options
  • Save bradyvercher/9997279 to your computer and use it in GitHub Desktop.
Save bradyvercher/9997279 to your computer and use it in GitHub Desktop.
A concept for overriding parent theme JavaScript in a child theme.
window.themeName = window.themeName || {};
(function( window, $, undefined ) {
'use strict';
// Override the carousel config properties.
themeName.config.carousel.autoPlay = true;
themeName.setupCarousel = function() {
// Override the carousel set up without affecting anything else.
};
})( this, jQuery );
window.themeName = window.themeName || {};
(function( window, $, undefined ) {
'use strict';
$.extend( window.themeName, {
config: {
// Default carousel properties.
carousel: {
autoPlay: false
}
},
init: function() {
// Initialize the theme JS.
},
setupCarousel: function() {
// Default carousel functionality.
// $( '.carousel' ).carousel( this.config.carousel );
},
setupGalleries: function() {
// Default gallery functionality.
}
});
$( document ).ready(function() {
themeName.init();
themeName.setupCarousel();
themeName.setupGalleries();
});
})( this, jQuery );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment