pgwslideshow.js
function() {
            var containerWidth = pgwSlideshow.plugin.find('.ps-list').width();
            var listObject = pgwSlideshow.plugin.find('.ps-list > ul');
            var listWidth = listObject.width();  

            var marginLeft = parseInt(listObject.css('margin-left'));
            var marginRight = parseInt(listObject.css('margin-right'));
            containerWidth -= (marginLeft + marginRight);

            var visibleZoneStart = Math.abs(parseInt(listObject.css('left')));
            var visibleZoneEnd = visibleZoneStart + containerWidth;
            var elementZoneStart = pgwSlideshow.plugin.find('.ps-list .ps-selected').position().left;
            var elementZoneEnd = elementZoneStart + pgwSlideshow.plugin.find('.ps-list .ps-selected').width();

            if ((elementZoneStart < visibleZoneStart) || (elementZoneEnd > visibleZoneEnd) || (listWidth > containerWidth && visibleZoneEnd > elementZoneEnd)) {
                var maxPosition = -(listWidth - containerWidth);

                if (-elementZoneStart < maxPosition) {
                    listObject.css('left', maxPosition);
                } else {
                    listObject.css('left', -elementZoneStart);
                }
            }

            return true;
        }
function() {
            var containerWidth = pgwSlideshow.plugin.find('.ps-list').width();
            var listObject = pgwSlideshow.plugin.find('.ps-list > ul');
            var listWidth = listObject.width();  

            var marginLeft = parseInt(listObject.css('margin-left'));
            var marginRight = parseInt(listObject.css('margin-right'));
            containerWidth -= (marginLeft + marginRight);

            var visibleZoneStart = Math.abs(parseInt(listObject.css('left')));
            var visibleZoneEnd = visibleZoneStart + containerWidth;
            var elementZoneStart = pgwSlideshow.plugin.find('.ps-list .ps-selected').position().left;
            var elementZoneEnd = elementZoneStart + pgwSlideshow.plugin.find('.ps-list .ps-selected').width();

            if ((elementZoneStart < visibleZoneStart) || (elementZoneEnd > visibleZoneEnd) || (listWidth > containerWidth && visibleZoneEnd > elementZoneEnd)) {
                var maxPosition = -(listWidth - containerWidth);

                if (-elementZoneStart < maxPosition) {
                    listObject.css('left', maxPosition);
                } else {
                    listObject.css('left', -elementZoneStart);
                }
            }

            return true;
        }
function ( ) { var containerWidth = pgwSlideshow . plugin . find ( '.ps-list' ) . width ( ) ; var listObject = pgwSlideshow . plugin . find ( '.ps-list > ul' ) ; var listWidth = listObject . width ( ) ; var marginLeft = parseInt ( listObject . css ( 'margin-left' ) ) ; var marginRight = parseInt ( listObject . css ( 'margin-right' ) ) ; containerWidth -= ( marginLeft + marginRight ) ; var visibleZoneStart = Math . abs ( parseInt ( listObject . css ( 'left' ) ) ) ; var visibleZoneEnd = visibleZoneStart + containerWidth ; var elementZoneStart = pgwSlideshow . plugin . find ( '.ps-list .ps-selected' ) . position ( ) . left ; var elementZoneEnd = elementZoneStart + pgwSlideshow . plugin . find ( '.ps-list .ps-selected' ) . width ( ) ; if ( ( elementZoneStart < visibleZoneStart ) || ( elementZoneEnd > visibleZoneEnd ) || ( listWidth > containerWidth && visibleZoneEnd > elementZoneEnd ) ) { var maxPosition = - ( listWidth - containerWidth ) ; if ( - elementZoneStart < maxPosition ) { listObject . css ( 'left' , maxPosition ) ; } else { listObject . css ( 'left' , - elementZoneStart ) ; } } return true ; }
Check the visibility of the selected item
Check the visibility of the selected item