Skip to content

Instantly share code, notes, and snippets.

@skylerto
Created January 9, 2017 20:41
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 skylerto/74b37e7d874d4a4da4e4e415965e956e to your computer and use it in GitHub Desktop.
Save skylerto/74b37e7d874d4a4da4e4e415965e956e to your computer and use it in GitHub Desktop.
<div class="container ... ">
<div class="component ... ${getStepClass(properties.step, 1)}">
STEP 1
</div>
<div class="component ... ${getStepClass(properties.step, 2)}">
STEP 2
</div>
<div class="component ... ${getStepClass(properties.step, 3)}">
STEP 3
</div>
<div class="component ... ${getStepClass(properties.step, 4)}">
STEP 4
</div>
</div>
<!-- This would actually go in a javascript file -->
<script type="text/javascript">
/**
* Determine which css class to add.
*
* pageIndex - the actual step value from properties.step
* step - the step from the HTML.
*/
function getStepClass(pageIndex, step) {
if (pageIndex < step) {
return 'completed';
} else if (pageIndex === step) {
return 'active';
} else {
return 'inactive';
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment