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 1
1
{
2
2
"name" : " jquery-bootstrap-scrolling-tabs" ,
3
- "version" : " 2.4 .0" ,
3
+ "version" : " 2.5 .0" ,
4
4
"main" : [
5
5
" ./dist/jquery.scrolling-tabs.js" ,
6
6
" ./dist/jquery.scrolling-tabs.css"
Original file line number Diff line number Diff line change 934
934
activeTabLeftPos ,
935
935
activeTabRightPos ,
936
936
rightArrowLeftPos ,
937
+ activeTabWidth ,
938
+ leftPosOffset ,
939
+ offsetToMiddle ,
937
940
leftScrollArrowWidth ,
938
941
rightScrollArrowWidth ;
939
942
955
958
}
956
959
957
960
rightScrollArrowWidth = stc . $slideRightArrow . outerWidth ( ) ;
961
+ activeTabWidth = $activeTab . outerWidth ( ) ;
958
962
959
963
/**
960
964
* @author poletaew
961
965
* We need relative offset (depends on $fixedContainer), don't absolute
962
966
*/
963
967
activeTabLeftPos = $activeTab . offset ( ) . left - stc . $fixedContainer . offset ( ) . left ;
964
- activeTabRightPos = activeTabLeftPos + $activeTab . outerWidth ( ) ;
968
+ activeTabRightPos = activeTabLeftPos + activeTabWidth ;
965
969
966
970
rightArrowLeftPos = stc . fixedContainerWidth - rightScrollArrowWidth ;
967
971
981
985
}
982
986
} else {
983
987
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 ;
985
992
smv . slideMovableContainerToLeftPos ( ) ;
986
993
return true ;
987
994
} else {
988
995
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 ) ;
991
999
smv . slideMovableContainerToLeftPos ( ) ;
992
1000
return true ;
993
1001
}
You can’t perform that action at this time.
0 commit comments