Skip to content

Commit

Permalink
fix back to top arrow- position:fixed- ignored in Chrome & Firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
christinach committed Mar 7, 2019
1 parent 6e6aab5 commit 893081e
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
//= require universal_viewer
//= require pom_boot
//= require more_link
//= require back_to_top

Blacklight.onLoad(function() {
Initializer = require('pom_boot')
Expand Down
14 changes: 14 additions & 0 deletions app/assets/javascripts/back_to_top.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
$(document).ready(function() {
$(window).scroll(function(){
if ($(this).scrollTop() > 100) {
$('.back-to-top').fadeIn();
} else {
$('.back-to-top').fadeOut();
}
});

$('.back-to-top').click(function(){
$('html, body').animate({scrollTop : 0},800);
return false;
});
});
1 change: 0 additions & 1 deletion app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ li[dir=rtl] {
// transform:perspective(800px) rotateY(-180deg);
}
}
body { -webkit-perspective: 800px; -moz-perspective: 800px; -o-perspective: 800px; perspective: 800px; }

.card-backing {
box-shadow: $exhibit-card-shadow;
Expand Down
28 changes: 27 additions & 1 deletion app/assets/stylesheets/footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,31 @@
}

.back-to-top {
line-height: 1.75em;
background: image-url("up-arrow.svg") center 50% no-repeat rgba(255,255,255,.8);
bottom: 30px;
display: none;
height: 40px;
overflow: hidden;
position: fixed;
right: 10px;
text-decoration: none;
text-indent: 100%;
white-space: nowrap;
width: 40px;

@media only screen and (min-width: 768px) {
bottom: 20px;
right: 20px;
}

@media only screen and (min-width: 1024px) {
bottom: 30px;
height: 60px;
right: 30px;
width: 60px;
}

&:hover{
text-decoration: none;
}
}
2 changes: 1 addition & 1 deletion app/views/shared/_footer.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,5 @@
</div>
</div>
</div>
<a href="#l-page" class="back-to-top">Top</a>
<a href="#l-page" class="back-to-top"></a>
</footer>

0 comments on commit 893081e

Please sign in to comment.