Navigation bar basic javascript

Hello everyone!

I got a question about a basic things with javascript for navigation bar.

In many sites used the following snippset:

var $test_top_div = $(’#test_top_div’);
var test_top_balance = $test_top_div.offset().top;
$(window).scroll(function() {
if ($(window).scrollTop() >= test_top_balance) {
else {

I use this with above a viewport units image slider. So that means when user scroll to test_top_balance div is got display with position: fixed; on top.

My QUESTION how can add extra 60px (my nav height is 60 px) when te user still not scroll towards to get position fixed? I try something like operators != but is not really work?

We would need to see your full project code give you better advice. We don’t know what the code looks like for elements/classes the above references.