Created
January 16, 2014 18:34
-
-
Save frankstallone/8460618 to your computer and use it in GitHub Desktop.
Generic function for a progress bar. Made with Zurb Foundation in mind.
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 progressBar(v) { | |
'use strict'; | |
var value = parseInt(v); | |
var currentBar = parseInt($('.meter')[0].style.width.replace(/[^\d]/g, '')); | |
var newBar = value + currentBar; | |
if (value + currentBar > 100) { | |
$('.meter').css('width', '100%'); | |
} else if (value + currentBar < 0) { | |
$('.meter').css('width', '0%'); | |
} else { | |
$('.meter').css('width', newBar + '%'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment