修复选项卡右侧滑动到视区bug

This commit is contained in:
shuzheng 2016-12-09 22:04:51 +08:00
parent f0f51278b9
commit 283caaeb1c
1 changed files with 2 additions and 2 deletions

View File

@ -61,8 +61,8 @@ $(function() {
});
}
// 滚动到可视区域:在右侧
if(($('.content_tab>ul').scrollLeft() + document.getElementById('tabs').clientWidth) < ($(this).position().left + $(this).width())) {
var left = ($(this).position().left + $(this).width()) - document.getElementById('tabs').clientWidth;
if(($(this).position().left + $(this).width() - marginLeft) > document.getElementById('tabs').clientWidth) {
var left = $('.content_tab>ul').scrollLeft() + (($(this).position().left + $(this).width() - marginLeft) - document.getElementById('tabs').clientWidth);
$('.content_tab>ul').animate({scrollLeft: left}, 200, function() {
initScrollState();
});