jquery if nav is clicked then do this else

Posted: - Source : stackoverflow

Basically i have a navigation with an arrow pointer and when each section comes into view i want the arrow to display under that.

The simple jquery if you click on a nav item

$(".subnav ul li").click(function () {
    $('.subnav ul li span').hide();
    $(this).find('span').show();
});

And the on scroll to check if the section is in view

$(window).scroll(function () {
    var t = $(window).height() / 2;
    if ($(this).scrollTop() >= $("#how-it-works").offset().top) {
        $('.subnav ul li span').hide();
        $(".subnav ul a:nth-child(1) li").find('span').show();
    }
    if ($(this).scrollTop() >= $("#pick").offset().top - 100) {
        $('.subnav ul li span').hide();
        $(".subnav ul a:nth-child(2) li").find('span').show();
    }
    if ($(this).scrollTop() >= $("#ma-faqs").offset().top - 100) {
        $('.subnav ul li span').hide();
        $(".subnav ul a:nth-child(3) li").find('span').show();
    }
    if ($(this).scrollTop() >= $("#reviews").offset().top - t) {
        $('.subnav ul li span').hide();
        $(".subnav ul a:nth-child(4) li").find('span').show();
    }
    if ($(window).scrollTop() + $(window).height() > $(document).height() - 200) {
        $('.subnav ul li span').hide();
        $(".subnav ul a:nth-child(5) li").find('span').show();
    }
    if ($(this).scrollTop() >= $("#get-started").offset().top - t) {
        $('.subnav ul li span').hide();
        $(".subnav ul a:nth-child(5) li").find('span').show();
    }
});

Basically right now if you click on the last nav item as the page scrolls down to it each arrow will show as you go past the section but I want to get rid of this behaviour if you click on a nav item and not scroll.