$(window).scroll(function() {
if ( $(".something").length ) {
var nav = $(".something");
if ( $(window).scrollTop() >= 200 ) {
nav.addClass("active");
} else
nav.removeClass("active");
}
});
our class=“something” element is anchor navigation, which switch to position: fixed when scrolling
lenght is there to be kinda active only on sites where is anchor navigation element.
your code should work. But we did not attach it to some Main template, as we have no such template.
We let it as pure JS to be loaded by Meteor by default.
Look, I have a main template and when I scroll to some div it have to be visible.
When I write code not inside of main template, it’s still not working, in the bottom is print screen of that