solved. Deal with
in a nested way.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<style>
*{
padding: 0;
margin: 0;
}
body{
line-height: 1.7;
font-family: 'Courier New', Courier, monospace;
}
.list-item{
padding: 10px;
}
.list-item + .list-item{
padding-top: 0;
}
.nav-list{
display: flex;
}
.nav-item{
flex-shrink: 0;
padding: 10px;
}
.outer-wrapper{
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
}
.inner-wrapper{
overflow: hidden;
background: -sharpe1e1e1;
}
.nav-fixed-container{
position: fixed;
left: 0;
right: 0;
top: 0;
z-index: 999;
}
.nav-container{
}
.nav-container.hidden{
visibility: hidden;
}
</style>
<title>Document</title>
</head>
<body>
<div class="nav-fixed-container" data-js-navFixedContainer></div>
<div class="outer-wrapper" data-js-outerWrapper>
<div class="outer-content" data-js-outerContent>
<div class="nav-container" data-js-navContainer>
<div class="inner-wrapper" data-js-innerWrapper>
<div class="inner-content" data-js-innerContnet>
<div class="nav-list" data-js-navList>
<div class="nav-item" data-js-navItem><a href=""></a></div>
<div class="nav-item" data-js-navItem><a href=""></a></div>
<div class="nav-item" data-js-navItem><a href=""></a></div>
<div class="nav-item" data-js-navItem><a href=""></a></div>
<div class="nav-item" data-js-navItem><a href="">Q</a></div>
<div class="nav-item" data-js-navItem><a href=""></a></div>
<div class="nav-item" data-js-navItem><a href=""></a></div>
</div>
</div>
</div>
</div>
<div class="list">
<div class="list-item">Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis nulla sunt dolorum, recusandae, itaque voluptatum in accusamus velit error vero rerum ex similique possimus autem? Nam hic aspernatur a! Quis?</div>
<div class="list-item">Lorem <a href="">ipsum dolor</a> sit amet consectetur adipisicing elit. Blanditiis nulla sunt dolorum, recusandae, itaque voluptatum in accusamus velit error vero rerum ex similique possimus autem? Nam hic aspernatur a! Quis?</div>
<div class="list-item">Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis nulla sunt dolorum, recusandae, itaque voluptatum in accusamus velit error vero rerum ex similique possimus autem? Nam hic aspernatur a! Quis?</div>
<div class="list-item">Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis nulla sunt dolorum, recusandae, itaque voluptatum in accusamus velit error vero rerum ex similique possimus autem? Nam hic aspernatur a! Quis?</div>
<div class="list-item">Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis nulla sunt dolorum, recusandae, itaque voluptatum in accusamus velit error vero rerum ex similique possimus autem? Nam hic aspernatur a! Quis?</div>
<div class="list-item">Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis nulla sunt dolorum, recusandae, itaque voluptatum in accusamus velit error vero rerum ex similique possimus autem? Nam hic aspernatur a! Quis?</div>
<div class="list-item">Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis nulla sunt dolorum, recusandae, itaque voluptatum in accusamus velit error vero rerum ex similique possimus autem? Nam hic aspernatur a! Quis?</div>
<div class="list-item">Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis nulla sunt dolorum, recusandae, itaque voluptatum in accusamus velit error vero rerum ex similique possimus autem? Nam hic aspernatur a! Quis?</div>
<div class="list-item">Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis nulla sunt dolorum, recusandae, itaque voluptatum in accusamus velit error vero rerum ex similique possimus autem? Nam hic aspernatur a! Quis?</div>
<div class="list-item">Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis nulla sunt dolorum, recusandae, itaque voluptatum in accusamus velit error vero rerum ex similique possimus autem? Nam hic aspernatur a! Quis?</div>
<div class="list-item">Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis nulla sunt dolorum, recusandae, itaque voluptatum in accusamus velit error vero rerum ex similique possimus autem? Nam hic aspernatur a! Quis?</div>
<div class="list-item">Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis nulla sunt dolorum, recusandae, itaque voluptatum in accusamus velit error vero rerum ex similique possimus autem? Nam hic aspernatur a! Quis?</div>
<div class="list-item">Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis nulla sunt dolorum, recusandae, itaque voluptatum in accusamus velit error vero rerum ex similique possimus autem? Nam hic aspernatur a! Quis?</div>
<div class="list-item">Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis nulla sunt dolorum, recusandae, itaque voluptatum in accusamus velit error vero rerum ex similique possimus autem? Nam hic aspernatur a! Quis?</div>
</div>
</div>
</div>
<script src="./node_modules/jquery/dist/jquery.min.js"></script>
<script src="./node_modules/better-scroll/dist/bscroll.min.js"></script>
<script>
var setInnerScrollContentWidth, setNavContainerHeight;
var $outerWrapper = $('data-js-outerWrapper');
var $outerContent = $outerWrapper.find('data-js-outerContent');
var $innerWrapper = $('[data-js-innerWrapper]');
var $innerContent = $innerWrapper.find('[data-js-innerContnet]');
var $navList = $('[data-js-navList]');
var $navItems = $navList.find('[data-js-navItem]');
var $navContainer = $('[data-js-navContainer]');
var $navFixedContainer = $('[data-js-navFixedContainer]');;
var navHeight = $navList.outerHeight(true);
var navWidth = $navItems.eq(0).outerWidth(true) * $navItems.length;
// scroll
setInnerScrollContentWidth = function(width){
$innerContent.css('width', width);
};
setNavContainerHeight = function(height){
$navContainer.css('height', height);
};
var outerScroll = new BScroll('.outer-wrapper', {
click: true,
probeType: 2
});
//
outerScroll.on('scroll', function(pos){
var top = Math.abs(pos.y);
if(top >= navHeight){
$navFixedContainer.html($innerWrapper);
}else{
$navContainer.html($innerWrapper);
}
});
// scroll
setInnerScrollContentWidth(navWidth);
setNavContainerHeight(navHeight);
var innerScroll = new BScroll('.inner-wrapper', {
click: true,
scrollX: true
});
</script>
</body>
</html>