Created
January 21, 2016 21:50
-
-
Save pimtel/e2573a8a2820d2816b33 to your computer and use it in GitHub Desktop.
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
(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