TRI-283: add feader fixed
This commit is contained in:
@@ -240,7 +240,10 @@ b {
|
||||
|
||||
.header {
|
||||
margin-top: 0;
|
||||
position: relative;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100vw;
|
||||
padding: 40px 5px;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
.header {
|
||||
margin-top: 0;
|
||||
position: relative;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100vw;
|
||||
padding: 40px 5px;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
.header {
|
||||
margin-top: 0;
|
||||
position: relative;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100vw;
|
||||
padding: 40px 5px;
|
||||
|
||||
@media (max-width: 1304.98px) {
|
||||
|
||||
@@ -49,4 +49,32 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
</header>
|
||||
<script>
|
||||
function initHeaderState() {
|
||||
var activeClassname = 'scrolled';
|
||||
var $document = $(document);
|
||||
var headerTop = $('.header');
|
||||
console.log('dfsdfdsfsdfsdfsdfsfsfsfsdfsdf')
|
||||
var header = $('.header');
|
||||
$(window).off('scroll.header').on('scroll.header', function() {
|
||||
var scrollTop = $document.scrollTop();
|
||||
var headerHeight = header.outerHeight();
|
||||
var headerHeightTop = headerTop.outerHeight();
|
||||
var top = headerHeight - headerHeightTop - 20;
|
||||
if (scrollTop > headerHeight) {
|
||||
console.log(scrollTop, top)
|
||||
headerTop.addClass(activeClassname);
|
||||
$(document.body).addClass(activeClassname);
|
||||
} else {
|
||||
headerTop.removeClass(activeClassname);
|
||||
$(document.body).removeClass(activeClassname);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(()=>{
|
||||
initHeaderState();
|
||||
})
|
||||
console.log($,'sdsdads')
|
||||
</script>
|
||||
Reference in New Issue
Block a user