I want to create a transition in navbar (menu), when I scroll the page scroll, I do not know the name of the effect but it's this one (it just rolls down and the navbar is solid with a white background, or roll up it dissolves with a fade out effect) so that's the effect I want to create, I'm using the semantic-ui framework, of this effect, as soon as it occurs and the background becomes white, the font color also changes to black, what I did is only creates a simple fade effect, and does not change the text color!
HTML
<div class="ui inverted vertical masthead center aligned segment">
<div class="ui inverted pointing borderless main menu">
<div class="ui text container">
<div href="#" class="header item">
<img class="logo" src="https://semantic-ui.com/examples/assets/images/logo.png">ProjectName</div><ahref="#" class="item">Blog</a>
<a href="#" class="item">Articles</a>
<a href="#" class="ui right floated dropdown item">
Dropdown <i class="dropdown icon"></i>
<div class="menu">
<div class="item">Link Item</div>
<div class="item">Link Item</div>
<div class="divider"></div>
<div class="header">Header Item</div>
<div class="item">
<i class="dropdown icon"></i>
Sub Menu
<div class="menu">
<div class="item">Link Item</div>
<div class="item">Link Item</div>
</div>
</div>
<div class="item">Link Item</div>
</div>
</a>
</div>
</div>
</div>
CSS
body {
background-color: #FFFFFF;
}
.main.menu {
border-radius: 0;
border: none;
box-shadow: none;
transition:
box-shadow 0.5s ease,
padding 0.5s ease
;
}
.main.menu .item img.logo {
margin-right: 1.5em;
}
.overlay {
float: left;
margin: 0em 3em 1em 0em;
}
.overlay .menu {
position: relative;
left: 0;
transition: left 0.5s ease;
}
.main.menu.fixed {
background-color: #FFFFFF;
border: 1px solid #DDD;
box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.2);
}
.overlay.fixed .menu {
left: 800px;
}
JS
$(document)
.ready(function() {
// fix main menu to page on passing
$('.main.menu').visibility({
type: 'fixed'
});
$('.overlay').visibility({
type: 'fixed',
offset: 40
});
// show dropdown on hover
$('.main.menu .ui.dropdown').dropdown({
on: 'hover'
});
})
;
How can I create this effect?