Jquery adapting scroller code

Jquery adapting scroller code

Hi,
I have the jquery below which is being used in a worpdres theme, to control one page scrolling.
I'd like to adapt it to meet the following condition only AFTER the page has scrolled..
if #id1 a OR #id2 a ="active" remove the class "active" from #id3
Hope this makes sense, many thanks for any help.
the jquery scrolling code is

  1. /*-----------------------------------------------------------------------------------*/
    /*    SCROLL EFFECTS & HEADER
    /*-----------------------------------------------------------------------------------*/
    jQuery(window).load(function($){
    'use strict';
        /**
         * Page Loaded Stuff
         */
        jQuery('#page-loader').addClass('animated fadeOutDown');
        jQuery('body, html').addClass('window-loaded');
        jQuery('.light.scroller').animate({ 'opacity' : '1' });
       
        /**
         * Scroll Animations
         */
        jQuery('.animated').espy(function (entered, state) {
            var $this = jQuery(this);
            if (entered){
                $this.addClass( $this.attr('data-animation') );
            }
        });
       
        // Bind the event.
        jQuery(window).hashchange( function(){
            var url = location.hash;
            var minus = 64;
            if( jQuery('body').hasClass('admin-bar') )
                var minus = 96;
           
            if( url )
                jQuery("html, body").animate({ scrollTop: jQuery(url).offset().top - minus }, 500);
        });
       
        // Trigger the event (useful on page load).
        jQuery(window).hashchange();
       
        jQuery('#selectnav .scroller > a').click(function(){
            var $this = jQuery(this);
            jQuery('#selectnav .scroller').removeClass('active');
            $this.parent().addClass('active');
            jQuery('#selectnav .scroller a').removeClass('active');
            $this.addClass('active');
            history.pushState(null, null, $this.attr('href'));
            jQuery(window).hashchange();
            return false;
        });
       
        jQuery('a.scroller').click(function(){
            history.pushState(null, null, jQuery(this).attr('href'));
            jQuery(window).hashchange();
            return false;
        });
       
        jQuery(window).scroll(function(){
            var scrollTop = jQuery(window).scrollTop() / 12;
            var $header = jQuery('header#main-header');
            var $sub = jQuery('#selectnav ul');
           
            if( scrollTop < 20 ){
                $header.css({
                    'padding-top' : 25 - scrollTop,
                    'padding-bottom' : 25 - scrollTop
                });
                $sub.css({
                    'padding-top' : 42 - scrollTop
                });
            } else {
                $header.css({
                    'padding-top' : 5,
                    'padding-bottom' : 5
                });
                $sub.css({
                    'padding-top' : 22
                });
            }
           
            jQuery('#selectnav .scroller > a').each(function(){
                var scrollHref = jQuery(this).attr('href');
                if( jQuery(scrollHref).length > 0 ){
                    if( jQuery(window).scrollTop() > jQuery(scrollHref).offset().top - 240 ) {
                        jQuery('#selectnav .scroller').removeClass('active');
                        jQuery(this).parent().addClass('active');
                       
                    }
                }
            });
           
        });
    });