Skip to content

Instantly share code, notes, and snippets.

@pimtel
Created January 21, 2016 21:50
Show Gist options
  • Save pimtel/e2573a8a2820d2816b33 to your computer and use it in GitHub Desktop.
Save pimtel/e2573a8a2820d2816b33 to your computer and use it in GitHub Desktop.
(function ($) {
"use strict";
var Stepper = function (options) {
var defaults = {
steps: [],
currentStep: 0,
};
var styles = {
};
this.build = function (container) {
container = $(container);
var steps = options.steps || defaults.steps;
var html = $('<div>', { 'class': 'stepper' });
$.each(steps, function (index, step) {
index += 1;
var stepHtml = $('<div>', { 'class': 'step' });
stepHtml
.append(
$('<label>', { 'class': 'step-number' })
.append(
$('<span>').text(index)))
.append($('<label>').text(step));
html.append(stepHtml);
});
container.empty();
container.prepend($('<hr>'))
container.append(html);
};
};
$.fn.stepper = function (options) {
var stepper = new Stepper(options);
stepper.build(this);
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment