Last active
August 12, 2016 17:01
-
-
Save bluemango/e67584ed8a2337a6852b0aa3a6e02f1a to your computer and use it in GitHub Desktop.
Zendesk JS for foldable sections
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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