Skip to content

Commit 36854f4

Browse files
authored
Merge pull request #116 from billdevcode/feature-branch
Add navbar animation
2 parents 5204d0a + 2639ffd commit 36854f4

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ <h3>Contact me: <a href="mailto:[email protected]"><i class="fa fa-envelope"
120120
<a href="https://github.com/billdevcode" target="_blank" alt="Github"><img src="imgs/github-icon.png" width="50" height="50" class="img-circle"></a>
121121
</div>
122122
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
123+
<script src="src/index.js"></script>
123124
</body>
124125

125126
</html>

src/index.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
$(document).ready(function() {
2+
3+
$(window).on("scroll", function() {
4+
var scrollHeight = $(document).height();
5+
var scrollPosition = $(window).height() + $(window).scrollTop();
6+
var checkPosition = false;
7+
8+
if (scrollPosition >= 1520 && !checkPosition) {
9+
$("#navbar").css("background-color", "#222");
10+
checkPosition = true;
11+
} else if (scrollPosition < 1520) {
12+
$("#navbar").css("background-color", "transparent");
13+
checkPosition = false;
14+
}
15+
});
16+
17+
18+
19+
})

stylesheets/stylesheet.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ html, body {
33
overflow-x: hidden !important;
44
}
55

6+
#navbar {
7+
background-color: transparent;
8+
}
69
.navbar-header .navbar {
710
text-decoration: none;
811
max-width: 100%;
@@ -12,6 +15,12 @@ html, body {
1215
font-family: 'open sans';
1316
}
1417

18+
#navbar {
19+
background-color: transparent;
20+
-webkit-transition: all 0.8s ease;
21+
transition: all 0.8s ease;
22+
}
23+
1524
.home {
1625
height: 650px;
1726
background-image: url('../imgs/bg1.jpg');

0 commit comments

Comments
 (0)