Fix scroll up button (#638)

* fix scroll-up button

* dist changes

* changes

* changes
This commit is contained in:
Mridul97
2019-01-11 07:52:51 +05:30
committed by Jeffrey Warren
parent 2e9689b905
commit 9e5f252fd4
5 changed files with 46 additions and 15 deletions

View File

@@ -690,6 +690,25 @@ window.onload = function() {
} }
refreshOptions(); refreshOptions();
$(window).on('scroll', scrollFunction);
function scrollFunction() {
var shouldDisplay = $('body').scrollTop() > 20 || $(':root').scrollTop() > 20;
$('#move-up').css({
display: shouldDisplay ? 'block' : 'none'
});
}
function topFunction() {
$('body').animate({scrollTop: 0});
$(':root').animate({scrollTop: 0});
}
$('#move-up').on("click",topFunction);
// UI for each step: // UI for each step:
sequencer.setUI(DefaultHtmlStepUi(sequencer)); sequencer.setUI(DefaultHtmlStepUi(sequencer));

File diff suppressed because one or more lines are too long

View File

@@ -153,25 +153,19 @@ h1 {
height: auto; height: auto;
} }
.move-up { #move-up {
position: fixed; position: fixed;
bottom: 50px; bottom: 50px;
right: 40px; right: 40px;
z-index: 3; z-index: 550;
display: none; display: none;
z-index:1000;
}
.move-up button {
background:transparent; background:transparent;
border:none; border:none;
} }
.move-up button:active:hover {
padding-right:4px !important; #move-up i {
margin-right:2px;
}
.move-up i {
font-size:60px; font-size:60px;
opacity:0.5; opacity:0.7;
color:#BABABA; color:#BABABA;
} }

View File

@@ -52,6 +52,25 @@ window.onload = function() {
} }
refreshOptions(); refreshOptions();
$(window).on('scroll', scrollFunction);
function scrollFunction() {
var shouldDisplay = $('body').scrollTop() > 20 || $(':root').scrollTop() > 20;
$('#move-up').css({
display: shouldDisplay ? 'block' : 'none'
});
}
function topFunction() {
$('body').animate({scrollTop: 0});
$(':root').animate({scrollTop: 0});
}
$('#move-up').on("click",topFunction);
// UI for each step: // UI for each step:
sequencer.setUI(DefaultHtmlStepUi(sequencer)); sequencer.setUI(DefaultHtmlStepUi(sequencer));

View File

@@ -182,9 +182,8 @@
<footer> <footer>
<hr style="margin:20px;"><center><a class="color:grey;" id="clear-cache">Clear offline cache</a></center> <hr style="margin:20px;"><center><a class="color:grey;" id="clear-cache">Clear offline cache</a></center>
</footer> </footer>
<form class="move-up" action="#up">
<button><i class="fa fa-arrow-circle-o-up"></i></button> <button id="move-up"><i class="fa fa-arrow-circle-o-up"></i></button>
</form>
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {