如何在钛合金中使用左右箭头控制垂直滚动。如何连接滚动视图和左右箭头之间
这是代码:
var counter = 0;
rightArrow.addEventListener('click', function(e) {
counter++;
var wrapperChild = wrapperView.getChildren();
var scroll2 = verticalScroll.scrollTo(114, 0);
var scroll1 = verticalScroll.scrollTo(0, 0);
var scroll3 = verticalScroll.scrollTo(307, 0);
if (counter == 1) {
verticalScroll.scrollTo(114, 0);
alert(counter);
} else if (counter == 2) {
verticalScroll.scrollTo(307, 0);
alert(counter);
//}
} else if (counter == 3) {
verticalScroll.scrollTo(417, 0);
alert(counter);
} else if (counter == 4) {
verticalScroll.scrollTo(560, 0);
alert(counter);
} else if (counter == 5) {
verticalScroll.scrollTo(672, 0);
alert(counter);
}
});
leftArrow.addEventListener('click', function(e) {
if (counter == 0) verticalScroll.scrollTo(0, 0);
});
verticalScroll.addEventListener('scroll', function(e) {
Ti.API.info('Scrollview contents y offset: ' + e.x + 'Scrollview contents y offset: ' + e.y);
});