index.sjs 535 B

1234567891011
  1. function changeScollDistance(event, ownerComponent) {
  2. var scrollLeft = event.detail.scrollLeft;
  3. var scrollWidth = event.detail.scrollWidth;
  4. var viewWidth = ownerComponent.selectComponent('.ant-page-infinite-content').getBoundingClientRect().width;
  5. var moveDom = ownerComponent.selectComponent('.ant-page-infinite-move');
  6. var pageDeg = Math.ceil(scrollLeft / (scrollWidth - viewWidth) * 100);
  7. moveDom.setStyle("transform: translateX(".concat(pageDeg, "%);"));
  8. }
  9. export default {
  10. changeScollDistance: changeScollDistance
  11. };