Show and Update Weight without plates added

Shows the bar weight on page load. Added a script that updates the plates weights if no plate visuals exist.
This commit is contained in:
2018-10-30 12:50:20 -04:00
parent 74285d5fb2
commit 9a2a546021
3 changed files with 17 additions and 4 deletions

View File

@@ -122,7 +122,6 @@ p.subheading {
font-weight: 500;
line-height: 28px;
letter-spacing: .015px;
display: none;
}
.b-platevisual__weight{

View File

@@ -42,7 +42,7 @@
<div class="b-platevisual">
<div class="b-platevisual__container">
<div class="b-platevisual__weightfinalcontainer">
<p class="b-platevisual__weightfinal"><span class="input-element input-final">0</span> LBS</p>
<p class="b-platevisual__weightfinal"><span class="input-element input-final">45</span> LBS</p>
</div>
<div class="b-platevisual__weight">
<img src="images/BarBell.svg" class="b-platevisual__barbell">

View File

@@ -174,10 +174,12 @@
//reset inputs and plate visuals
jQuery(".b-infoentry__reset").click(function(){
var bar = jQuery(".input-bar").val();
jQuery(".input-weight, .input-weightsneeded").val('');
jQuery(".input-final, .input-difference").html('0');
jQuery(".input-final, .input-difference").html(bar);
animatePlatesOut();
jQuery(".b-infoentry__reset, .b-platevisual__weightfinal, .b-platevisual__weightdifference").hide();
jQuery(".b-platevisual__plates").html("");
jQuery(".b-infoentry__reset, .b-platevisual__weightdifference").hide();
});
//Saves scroll position on focus and restores
@@ -200,4 +202,16 @@
jQuery(".input-weight").on('blur', function(){
restoreScroll()
});
//Updates Bar Weight if plate visuals do not exist.
jQuery(".input-bar").on("change", function() {
var bar = jQuery(".input-bar").val();
if (jQuery('.b-platevisual__plate').length == 0){
jQuery(".input-final").html(bar);
}
});
});