温泉ui旋转木马 - 展出的活动

时间:2015-05-03 20:13:04

标签: mobile carousel onsen-ui

当显示某个Carousel项目时,有没有办法触发事件?

下面我给出了一个代码示例,并希望在显示最后一项时执行doSomething()函数:



<ons-template id="carrossel1.html">
  <ons-page ng-controller="CarrosselController">
	<ons-carousel fullscreen swipeable overscrollable auto-scroll>
		<ons-carousel-item ng-repeat="item in [1,2,3,4]" id="item{{item}}">
			Carousel Item {{item}} {{html}}
		</ons-carousel-item>
		<ons-carousel-item ng-repeat="item in [1]">
			FINAL (when this is show, I need to execute doSomething() function)
		</ons-carousel-item>
	</ons-carousel>
  </ons-page>
</ons-template>
&#13;
&#13;
&#13;

怎么做?

TKS

1 个答案:

答案 0 :(得分:1)

Carousel methods here。您可以将on(eventName, listener)与事件postchange一起使用。每次更改轮播时都会触发,然后在监听器中只需检查哪个索引处于活动状态getActiveCarouselItemIndex()

希望它有所帮助!