Revert "Fixed Scroll adjusting"

This reverts commit 2306e8aa85.
This commit is contained in:
2018-10-19 00:08:02 -04:00
parent cdef30df13
commit 56e0cf940f
3 changed files with 36 additions and 17 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -7,12 +7,14 @@
<meta name="description" content=""> <meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,user-scalable=0"/> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,user-scalable=0"/>
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="Lift It &#x1F4AA">
<meta name="application-name" content="Lift It &#x1F4AA"> <meta name="application-name" content="Lift It &#x1F4AA">
<link rel="manifest" href="site.webmanifest"> <link rel="manifest" href="site.webmanifest">
<link rel="apple-touch-icon" sizes="180x180" href="images/apple-touch-icon.png"> <link rel="apple-touch-icon" sizes="180x180" href="images/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="images/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="32x32" href="images/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="images/favicon-16x16.png"> <link rel="icon" type="image/png" sizes="16x16" href="images/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="mask-icon" href="images/safari-pinned-tab.svg" color="#5bbad5"> <link rel="mask-icon" href="images/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#cdff00"> <meta name="msapplication-TileColor" content="#cdff00">
<meta name="theme-color" content="#ffffff"> <meta name="theme-color" content="#ffffff">
@@ -91,7 +93,7 @@
<div class="b-calulatorinputs__inputcontainer"> <div class="b-calulatorinputs__inputcontainer">
<div class="b-calulatorinputs__weightinput"> <div class="b-calulatorinputs__weightinput">
<label for="Weight">WEIGHT (LBS)</label> <label for="Weight">WEIGHT (LBS)</label>
<input type="number" inputmode="numeric" pattern="[0-9]*" class="b-infoentry__input input-element input-weight" name="Weight" placeholder="What are you lifting? (LBS)" id="Weight"> <input type="number" onfocus="saveScroll()" onblur="restoreScroll()" inputmode="numeric" pattern="[0-9]*" class="b-infoentry__input input-element input-weight" name="Weight" placeholder="What are you lifting? (LBS)" id="Weight">
<input type="button" class="b-infoentry__button submit-element input-calculate" name="Calculate" value="LIFT" onclick="startcalc()"> <input type="button" class="b-infoentry__button submit-element input-calculate" name="Calculate" value="LIFT" onclick="startcalc()">
</div> </div>
<a href="#options"> <a href="#options">

View File

@@ -106,33 +106,50 @@
// The optional number (800) specifies the number of milliseconds it takes to scroll to the specified area // The optional number (800) specifies the number of milliseconds it takes to scroll to the specified area
$('html, body').animate({ $('html, body').animate({
scrollTop: $(hash).offset().top scrollTop: $(hash).offset().top
}, 500, function(){ }, 800, function(){
// Add hash (#) to URL when done scrolling (default click behavior) // Add hash (#) to URL when done scrolling (default click behavior)
window.location.hash = hash; window.location.hash = hash;
}); });
} // End if } // End if
}); });
});
//Saves scroll position on focus and restores //Saves scroll position on focus and restores
var savedScrollTop; var savedScrollTop
function saveScroll() { function saveScroll() {
savedScrollTop = jQuery(document).scrollTop(); var savedScrollTop = jQuery(document).scrollTop(); // save scroll position
console.log(savedScrollTop); console.log(savedScrollTop);
} }
function restoreScroll(savedScrollTop){
function restoreScroll(){
jQuery("html, body").animate({ jQuery("html, body").animate({
scrollTop: savedScrollTop scrollTop: savedScrollTop
}, 250).offset().top; }, 800).offset().top;
} }
//jQuery event watching //Failed scroll restore functions
jQuery(".input-weight").on("focus", function(){
saveScroll(); // jQuery("#Weight").blur(function(event) {
}); // $("html, body").animate({
jQuery(".input-weight").on('blur', function(){ // scrollTop: savedScrollTop
restoreScroll() // }, 800).offset().top;
}); // });
});
/*function restoreScroll() {
$("a").on('click', function(event) {
jQuery(window).scrollTop(savedScrollTop);*/
/* window.scrollTo({
top: "savedScrollTop",
behavior: "smooth"
}); // restore it*/
/*var savedScrollTop = $(document).scrollTop(); // save scroll position
<code that changes focus goes here>
$(document).scrollTop(savedScrollTop ); // restore it*/
// });