I've encountered a very peculiar issue.
Whenever I use the page down or fragmented identifier to jump to a specific div, my "go to top" image disappears.
Here is the code snippet:
HTML:
<a title="Go to top" href="#" class="back-to-top"></a>
Less (CSS):
.back-to-top {
position: fixed;
bottom: 50%;
right: 15px;
text-decoration: none;
overflow: hidden;
font-size: 12px;
padding: 1em;
display: none;
background-image: url("/images/go-top.png");
width: 48px;
height: 48px;
}
Javascript:
$(window).scroll(function() {
if ($(this).scrollTop() > offset) {
$('.back-to-top').fadeIn(600);
}
else {
$('.back-to-top').fadeOut(600);
}
});
$('.back-to-top').click(function(event) {
$('html, body').animate({scrollTop: 0}, duration);
return false;
});