Skip to content

Instantly share code, notes, and snippets.

@bluemango
Last active August 12, 2016 17:01
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 bluemango/e67584ed8a2337a6852b0aa3a6e02f1a to your computer and use it in GitHub Desktop.
Save bluemango/e67584ed8a2337a6852b0aa3a6e02f1a to your computer and use it in GitHub Desktop.
Zendesk JS for foldable sections
// Begin ScreenSteps
$(document).ready(function() {
$('.screensteps-nested-content').hide();
$('.screensteps-foldable-content-parent').click(function(event) {
event.preventDefault();
var stepId = $(event.target).attr('id').split('screensteps-step-')[1];
if (stepId) {
var contentId = ["nested-step", stepId].join("-");
$(event.target).toggleClass('expanded');
$('.screensteps-active-step').removeClass('screensteps-active-step');
$(event.target).addClass('screensteps-active-step');
$('#' + contentId).slideToggle('slow');
}
});
if (window.location.hash) {
var anchor = window.location.hash;
var el = $(anchor);
$(el).find('.screensteps-foldable-content-parent').first().trigger('click');
location.hash = null;
location.hash = anchor;
}
});
// End ScreenSteps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment