Ignore window scroll events while a manual scroll (tab click) is happening

This commit is contained in:
tfennelly committed 2016-03-23 13:59:29 +00:00
1 parent 3aaab3678e
commit 551b8b28ea
1 file changed
+11 -2
+11 -2
View File
@@ -63,7 +63,14 @@ $.when(getItems()).done(function(data){
////////////////////////////////
// scroll action......
var isManualScrolling = false;
function watchScroll(){
if (isManualScrolling) {
// We ignore scroll events when a manual scroll is in
// operation e.g. when the user clicks on a category tab.
return;
}
var $window = $(window);
var $jenkTools = $('#breadcrumbBar');
var winScoll = $window.scrollTop();
@@ -253,7 +260,6 @@ $.when(getItems()).done(function(data){
if(!elem) {elem = i;}
var $tab = $(['<li><a class="tab ',((i===0)?'active':''),'" href="#',cleanHref(elem.id),'">',elem.name,'</a></li>'].join(''))
.click(function(){
//e.preventDefault(e);
var $this = $(this).children('a');
var tab = $this.attr('href');
@@ -261,9 +267,12 @@ $.when(getItems()).done(function(data){
setTimeout(function(){resetActiveTab($this);},510);
isManualScrolling = true;
$('html,body').animate({
scrollTop: scrollTop
}, 500);
}, 500, function() {
isManualScrolling = false;
});
});
return $tab;
}