-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
related #8
- Loading branch information
Showing
3 changed files
with
21 additions
and
53 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,20 @@ | ||
//lets populate reel numbers | ||
var min = $("#rangeslider").attr("min"); | ||
var max = $("#rangeslider").attr("max"); | ||
var min = $(".rangeslider").attr("min"); | ||
var max = $(".rangeslider").attr("max"); | ||
|
||
// var rn = ""; | ||
// for (var i = min; i <= max; i++) { | ||
// rn += "<span>"+i+"</span>"; | ||
// } | ||
//$("#rn").html(rn); | ||
|
||
//triggering updateOutput manually | ||
updateOutput($("#rangeslider").val(), false); | ||
|
||
var rfigure, h, v; | ||
//lets display the static output now | ||
function updateOutput(figure, activate) { | ||
//if activate then add .active to #input-wrapper to help animate the #reel | ||
if(activate) | ||
$("#input-wrapper").addClass("active"); | ||
updateOutput($(".rangeslider").val()); | ||
|
||
var rfigure, h; | ||
function updateOutput(figure) { | ||
//because of the step param the slider will return values in multiple of 0.05 so we have to round it up | ||
rfigure = Math.round(figure); | ||
//displaying the static output | ||
$("#static-output").html(rfigure); | ||
$(".static-output").html(rfigure); | ||
|
||
//positioning #static-output and #reel | ||
//positioning .static-output and .reel | ||
//horizontal positioning first | ||
h = figure/max*($("#input-wrapper").width()-$("#reel").width()) + 'px'; | ||
//vertical positioning of #rn | ||
v = rfigure*$("#reel").height()*-1 + 'px'; | ||
h = figure/max*($(".input-wrapper").width()-$(".reel").width()) + 'px'; | ||
|
||
//applying the positions | ||
$("#static-output, #reel").css({left: h}); | ||
//#rn will be moved using transform+transitions for better animation performance. The false translateZ triggers GPU acceleration for better performance. | ||
$("#rn").css({transform: 'translateY('+v+') translateZ(0)'}); | ||
} | ||
function deactivate() { | ||
//remove .active from #input-wrapper | ||
$("#input-wrapper").removeClass("active"); | ||
$(".static-output, .reel").css({left: h}); | ||
} |