File tree Expand file tree Collapse file tree 5 files changed +27
-11
lines changed Expand file tree Collapse file tree 5 files changed +27
-11
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " jquery-bootstrap-scrolling-tabs" ,
3- "version" : " 2.4 .0" ,
3+ "version" : " 2.5 .0" ,
44 "main" : [
55 " ./dist/jquery.scrolling-tabs.js" ,
66 " ./dist/jquery.scrolling-tabs.css"
Original file line number Diff line number Diff line change 934934 activeTabLeftPos ,
935935 activeTabRightPos ,
936936 rightArrowLeftPos ,
937+ activeTabWidth ,
938+ leftPosOffset ,
939+ offsetToMiddle ,
937940 leftScrollArrowWidth ,
938941 rightScrollArrowWidth ;
939942
955958 }
956959
957960 rightScrollArrowWidth = stc . $slideRightArrow . outerWidth ( ) ;
961+ activeTabWidth = $activeTab . outerWidth ( ) ;
958962
959963 /**
960964 * @author poletaew
961965 * We need relative offset (depends on $fixedContainer), don't absolute
962966 */
963967 activeTabLeftPos = $activeTab . offset ( ) . left - stc . $fixedContainer . offset ( ) . left ;
964- activeTabRightPos = activeTabLeftPos + $activeTab . outerWidth ( ) ;
968+ activeTabRightPos = activeTabLeftPos + activeTabWidth ;
965969
966970 rightArrowLeftPos = stc . fixedContainerWidth - rightScrollArrowWidth ;
967971
981985 }
982986 } else {
983987 if ( activeTabRightPos > rightArrowLeftPos ) { // active tab off right side
984- stc . movableContainerLeftPos -= ( activeTabRightPos - rightArrowLeftPos + rightScrollArrowWidth ) ;
988+ leftPosOffset = activeTabRightPos - rightArrowLeftPos + rightScrollArrowWidth ;
989+ offsetToMiddle = stc . fixedContainerWidth / 2 ;
990+ leftPosOffset += offsetToMiddle - ( activeTabWidth / 2 ) ;
991+ stc . movableContainerLeftPos -= leftPosOffset ;
985992 smv . slideMovableContainerToLeftPos ( ) ;
986993 return true ;
987994 } else {
988995 leftScrollArrowWidth = stc . $slideLeftArrow . outerWidth ( ) ;
989- if ( activeTabLeftPos < leftScrollArrowWidth ) { // active tab off left side
990- stc . movableContainerLeftPos += leftScrollArrowWidth - activeTabLeftPos ;
996+ if ( activeTabLeftPos < 0 ) { // active tab off left side
997+ offsetToMiddle = stc . fixedContainerWidth / 2 ;
998+ stc . movableContainerLeftPos += ( - activeTabLeftPos ) + offsetToMiddle - ( activeTabWidth / 2 ) ;
991999 smv . slideMovableContainerToLeftPos ( ) ;
9921000 return true ;
9931001 }
You can’t perform that action at this time.
0 commit comments