dio-v
5/17/2016 - 11:53 AM

Poll for item until found or reject after x checks

Poll for item until found or reject after x checks

	var numChecked = 0;
	var newRow = '.sectionWrap[data-rowid="'+data.ROWID+'"]';
	var checkScroll = setInterval(function(){
		if($(newRow).length){
			clearInterval(checkScroll);
			console.log('scrolling to: '+newRow);
			$('html,body').animate({
				scrollTop: $(newRow).offset().top - 200
			});				
		}			
		numChecked++;
		if(numChecked === 10){clearInterval(checkScroll);console.log('tried scrolling but found nothing')}
	},500);