js/components/stalker.js
function(marker, type) {
        marker = $(marker);

        // Stop all the unnecessary processing
        if (type === 'activate' && marker.hasClass('is-stalked')) {
            return;
        } else if (type === 'deactivate' && !marker.hasClass('is-stalked')) {
            return;
        }

        var options = this.options,
            targetBy = options.targetBy,
            markBy = options.markBy,
            target = this.targets.filter(function() {
                return $(this).attr(targetBy).replace('#', '') === marker.attr(markBy);
            }),
            before,
            after,
            method;

        if (type === 'activate') {
            before = 'activating';
            after = 'activated';
            method = 'addClass';
        } else {
            before = 'deactivating';
            after = 'deactivated';
            method = 'removeClass';
        }

        this.fireEvent(before, [marker, target]);

        marker[method]('is-stalked');
        target[method]('is-active');

        this.fireEvent(after, [marker, target]);
    }
function(marker, type) {
        marker = $(marker);

        // Stop all the unnecessary processing
        if (type === 'activate' && marker.hasClass('is-stalked')) {
            return;
        } else if (type === 'deactivate' && !marker.hasClass('is-stalked')) {
            return;
        }

        var options = this.options,
            targetBy = options.targetBy,
            markBy = options.markBy,
            target = this.targets.filter(function() {
                return $(this).attr(targetBy).replace('#', '') === marker.attr(markBy);
            }),
            before,
            after,
            method;

        if (type === 'activate') {
            before = 'activating';
            after = 'activated';
            method = 'addClass';
        } else {
            before = 'deactivating';
            after = 'deactivated';
            method = 'removeClass';
        }

        this.fireEvent(before, [marker, target]);

        marker[method]('is-stalked');
        target[method]('is-active');

        this.fireEvent(after, [marker, target]);
    }
function ( marker , type ) { marker = $ ( marker ) ; // Stop all the unnecessary processing if ( type === 'activate' && marker . hasClass ( 'is-stalked' ) ) { return ; } else if ( type === 'deactivate' && ! marker . hasClass ( 'is-stalked' ) ) { return ; } var options = this . options , targetBy = options . targetBy , markBy = options . markBy , target = this . targets . filter ( function ( ) { return $ ( this ) . attr ( targetBy ) . replace ( '#' , '' ) === marker . attr ( markBy ) ; } ) , before , after , method ; if ( type === 'activate' ) { before = 'activating' ; after = 'activated' ; method = 'addClass' ; } else { before = 'deactivating' ; after = 'deactivated' ; method = 'removeClass' ; } this . fireEvent ( before , [ marker , target ] ) ; marker [ method ] ( 'is-stalked' ) ; target [ method ] ( 'is-active' ) ; this . fireEvent ( after , [ marker , target ] ) ; }
Either active or deactivate a target based on the marker.

@param {Element} marker
@param {String} type
Either active or deactivate a target based on the marker .