src/jquery.timelineMe.js
function(items) {
            if(!items)
                return;

            var positions;
            if(this.settings.orientation == 'horizontal')
                positions = ['top', 'bottom'];
            else
                positions = ['left', 'right'];

            for(var i = 0; i < this.content.length; i++) {
                if(this.content[i].forcePosition && positions.indexOf(this.content[i].forcePosition) >= 0) {
                        this.content[i].position = this.content[i].forcePosition;
                } else if(!this.content[i].position) {
                    switch(this.content[i].type) {
                        case 'milestone':
                            if(this.settings.orientation == 'horizontal')
                                this.content[i].position = 'top';
                            else
                                this.content[i].position = 'right';
                            break;
                        case 'smallItem':
                            if(i == 0)
                                this.content[i].position = this.settings.orientation == 'horizontal' ? 'top' : 'left';
                            else if(this.settings.orientation == 'horizontal' && this.content[i - 1].position == 'top')
                                this.content[i].position = 'bottom';
                            else if(this.settings.orientation == 'horizontal' && this.content[i - 1].position == 'bottom')
                                this.content[i].position = 'top';
                            else if(this.settings.orientation != 'horizontal' && this.content[i - 1].position == 'left')
                                this.content[i].position = 'right';
                            else if(this.settings.orientation != 'horizontal' && this.content[i - 1].position == 'right')
                                this.content[i].position = 'left';
                            else
                                this.content[i].position = this.settings.orientation == 'horizontal' ? 'top' : 'left';
                            break;
                        case 'bigItem':
                            break;
                    }
                }
            }

            return items;
        }
function(items) {
            if(!items)
                return;

            var positions;
            if(this.settings.orientation == 'horizontal')
                positions = ['top', 'bottom'];
            else
                positions = ['left', 'right'];

            for(var i = 0; i < this.content.length; i++) {
                if(this.content[i].forcePosition && positions.indexOf(this.content[i].forcePosition) >= 0) {
                        this.content[i].position = this.content[i].forcePosition;
                } else if(!this.content[i].position) {
                    switch(this.content[i].type) {
                        case 'milestone':
                            if(this.settings.orientation == 'horizontal')
                                this.content[i].position = 'top';
                            else
                                this.content[i].position = 'right';
                            break;
                        case 'smallItem':
                            if(i == 0)
                                this.content[i].position = this.settings.orientation == 'horizontal' ? 'top' : 'left';
                            else if(this.settings.orientation == 'horizontal' && this.content[i - 1].position == 'top')
                                this.content[i].position = 'bottom';
                            else if(this.settings.orientation == 'horizontal' && this.content[i - 1].position == 'bottom')
                                this.content[i].position = 'top';
                            else if(this.settings.orientation != 'horizontal' && this.content[i - 1].position == 'left')
                                this.content[i].position = 'right';
                            else if(this.settings.orientation != 'horizontal' && this.content[i - 1].position == 'right')
                                this.content[i].position = 'left';
                            else
                                this.content[i].position = this.settings.orientation == 'horizontal' ? 'top' : 'left';
                            break;
                        case 'bigItem':
                            break;
                    }
                }
            }

            return items;
        }
function ( items ) { if ( ! items ) return ; var positions ; if ( this . settings . orientation == 'horizontal' ) positions = [ 'top' , 'bottom' ] ; else positions = [ 'left' , 'right' ] ; for ( var i = 0 ; i < this . content . length ; i ++ ) { if ( this . content [ i ] . forcePosition && positions . indexOf ( this . content [ i ] . forcePosition ) >= 0 ) { this . content [ i ] . position = this . content [ i ] . forcePosition ; } else if ( ! this . content [ i ] . position ) { switch ( this . content [ i ] . type ) { case 'milestone' : if ( this . settings . orientation == 'horizontal' ) this . content [ i ] . position = 'top' ; else this . content [ i ] . position = 'right' ; break ; case 'smallItem' : if ( i == 0 ) this . content [ i ] . position = this . settings . orientation == 'horizontal' ? 'top' : 'left' ; else if ( this . settings . orientation == 'horizontal' && this . content [ i - 1 ] . position == 'top' ) this . content [ i ] . position = 'bottom' ; else if ( this . settings . orientation == 'horizontal' && this . content [ i - 1 ] . position == 'bottom' ) this . content [ i ] . position = 'top' ; else if ( this . settings . orientation != 'horizontal' && this . content [ i - 1 ] . position == 'left' ) this . content [ i ] . position = 'right' ; else if ( this . settings . orientation != 'horizontal' && this . content [ i - 1 ] . position == 'right' ) this . content [ i ] . position = 'left' ; else this . content [ i ] . position = this . settings . orientation == 'horizontal' ? 'top' : 'left' ; break ; case 'bigItem' : break ; } } } return items ; }
Method that fill 'position' field, depending on item's forcePosition option, on item's type and on position of the previous item
Method that fill position field depending on item s forcePosition option on item s type and on position of the previous item