Skip to content

Instantly share code, notes, and snippets.

@ssylvia
Last active July 19, 2016 14:35
Show Gist options
  • Save ssylvia/79d2297e0e2a04bae018895c13091331 to your computer and use it in GitHub Desktop.
Save ssylvia/79d2297e0e2a04bae018895c13091331 to your computer and use it in GitHub Desktop.
require([“dojo/topic”], function(topic) {
/* * Custom Javascript to be executed while the application is initializing goes here */
// The application is ready
topic.subscribe(“tpl-ready”, function(){
/* * Custom Javascript to be executed when the application is ready goes here */
// Add a click event for each group of buttons
// Use Jquery class selector (https://api.jquery.com/class-selector/) to select a group of buttons and add a click event
$('.section-1-buttons').click(function() {
// When first clicked, remove the active class from all buttons in the group
$('.section-1-buttons').removeClass('active');
// Add the active class to only the button you click use the "$(this)" selector to get active target
$(this).addClass('active');
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment