当向下滚动标题时不应该是可见的,只需在向上滚动标题后就可以看到。我的代码适用于iPhone,但在其他移动设备上,如三星,nexus ....它不是。向下滚动显示我的粘贴标题,这是我不想要的。
任何想法如何解决这个问题?
段:
$(function () {
var lastPos = 0;
$(window).scroll(function() {
var pos = $(this).scrollTop();
if (pos > lastPos || pos == 0) {
// scroll down
$(".backButton").attr('data-position','');
} else {
// scroll up
$(".backButton").attr('data-position','fixed');
}
lastPos = pos;
});
});

.backButton {
background-color: rgba(255,255,255,0.9);
border: 1px solid #000;
border-width: 0 0 1px 0;
box-sizing: border-box;
overflow: hidden;
text-transform: uppercase;
z-index: 100;
margin: 0 auto;
position: absolute;
top: 0;
left: 16px;
right: 16px;
max-width: 100%;
webkit-transform: translate3D(0, 0, 0);
-ms-transform: translate3D(0, 0, 0);
transform: translate3D(0, 0, 0);
}
.backButton[data-position=fixed] {
left: 16px;
position: fixed;
right: 16px;
top: 0px;
width: auto;
}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="backButton">
<a href="#" class="backLink">BACK</a>
</div>
&#13;