Update js/Weight Calculation Script-Edited-Jquery-V4.js

Script is consolidated but does not animate off. Still need to figure out why.
This commit is contained in:
2018-10-23 18:55:17 -04:00
parent d94d1ec2a5
commit 9a2163c4dc

View File

@@ -43,6 +43,28 @@
// var plateloader = jQuery(".b-platevisual__plates").html('<img src="images/45lbs-Plate.svg" class="b-platevisual__plate b-platevisual__plate--45">'); // var plateloader = jQuery(".b-platevisual__plates").html('<img src="images/45lbs-Plate.svg" class="b-platevisual__plate b-platevisual__plate--45">');
// console.log(plateloader); // console.log(plateloader);
function animatePlatesOut () {
jQuery('.b-platevisual__plates--left').animate({
opacity: 0,
left: "-16%",
}, {duration: 500, queue: false });
jQuery('.b-platevisual__plates--right').animate({
opacity: 0,
left: "116%",
}, {duration: 500, queue: false });
}
function animatePlatesIn () {
jQuery('.b-platevisual__plates--left').animate({
opacity: 1,
left: "21%",
}, {duration: 500, queue: false });
jQuery('.b-platevisual__plates--right').animate({
opacity: 1,
left: "79%",
}, {duration: 500, queue: false });
}
//plate calulation function //plate calulation function
function platecalculator ( plateWeights, platesAvailable, target, finalWeight) { function platecalculator ( plateWeights, platesAvailable, target, finalWeight) {
@@ -87,9 +109,9 @@
//replaces and animates html for plates required to bar. //replaces and animates html for plates required to bar.
//if statment works but need to figureout how to step animation. //if statment works but need to figureout how to step animation.
if (jQuery('.b-platevisual__plate').length > 0) { if (jQuery('.b-platevisual__plate').length > 0) {
console.log("Test") console.log("If Statment Fired")
//animates plates off //animates plates off
jQuery('.b-platevisual__plates--left').animate({ /*jQuery('.b-platevisual__plates--left').animate({
opacity: 0, opacity: 0,
left: "-16%", left: "-16%",
}, {duration: 500, queue: false }); }, {duration: 500, queue: false });
@@ -107,19 +129,27 @@
jQuery('.b-platevisual__plates--right').animate({ jQuery('.b-platevisual__plates--right').animate({
opacity: 1, opacity: 1,
left: "79%", left: "79%",
}, {duration: 500, queue: false }); }, {duration: 500, queue: false });*/
//animates plates off
animatePlatesOut();
//updates plates
jQuery(".b-platevisual__plates").html(weighthtml);
//animates plates back on
setTimeout(animatePlatesIn(), 250);
} else { } else {
//updates plates //updates plates
jQuery(".b-platevisual__plates").html(weighthtml); jQuery(".b-platevisual__plates").html(weighthtml);
//animates plates back on //animates plates back on
jQuery('.b-platevisual__plates--left').animate({ /*jQuery('.b-platevisual__plates--left').animate({
opacity: 1, opacity: 1,
left: "21%", left: "21%",
}, {duration: 500, queue: false }); }, {duration: 500, queue: false });
jQuery('.b-platevisual__plates--right').animate({ jQuery('.b-platevisual__plates--right').animate({
opacity: 1, opacity: 1,
left: "79%", left: "79%",
}, {duration: 500, queue: false }); }, {duration: 500, queue: false });*/
//animates plates back on
animatePlatesIn();
} }
} }