Skip to content

Instantly share code, notes, and snippets.

@hellofromtonya
Created January 4, 2017 19:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hellofromtonya/c4545a607d1322ec4f366c4c119c54af to your computer and use it in GitHub Desktop.
Save hellofromtonya/c4545a607d1322ec4f366c4c119c54af to your computer and use it in GitHub Desktop.
Basic Collapsible Content jQuery Script Structure
;(function($, window, document, undefined){
'use strict';
var $qaQuestions, $qaAnswers, $qaIcons,
$teaserMessages, $teaserHiddenContents, $teaserIcons;
var init = function() {
$qaQuestions = $('.qa--question');
$qaAnswers = $qaQuestions.next();
$qaIcons = $qaQuestions.find('.qa--icon');
$qaQuestions.on('click', {contentType: 'qa'}, clickHandler);
$teaserMessages = $('.teaser--visible-message');
$teaserHiddenContents = $teaserMessages.next();
$teaserIcons = $teaserMessages.find('.teaser--icon');
$teaserMessages.on('click', {contentType: 'teaser'}, clickHandler);
}
var clickHandler = function( event ) {
console.log( event );
}
function changeIcon() {
}
function getIndex() {
}
function getHiddenContent() {
}
function getIcon() {
}
function getIconClasses() {
}
$(document).ready(function(){
init();
});
})(jQuery, window, document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment