开发者

How to catch dojox.mobile.view events?

I am developing a mobile web app using dojo. I have a view with a video in it.

    <div id="v1" dojoType="dojox.mobile.View"> 
   <h1 id="h1" dojoType="dojox.mobile.Heading" back="Media" moveTo="media">IT Models</h1>
   <video id="vid1" controls width="100%" poster="itModels.jpg"><source src="itModels.m4v"></video>开发者_如何学JAVA;
   </div>

When I start the video on the view and then click the back button to go to another view, media, the video keeps playing. I want to catch the event when the v1 view is no longer visible so I can turn off the video with a dojo.byId("vid1").pause();

My issue is that I can't catch any of the events associated with the V1 view

There is documented a number of events associated with dojox.mobile.view at http://dojotoolkit.org/api/1.6/dojox/mobile/View but I can't catch any. I have tried with both the dojo.connect and the new 1.7 dojo.on function.

dojo.on(dojo.byId("v1"),"onAfterTransitionOut",function() {dojo.byId("vid1").pause()});

The onAfterTransitionOut event never gets fired.

Any ideas?


I ended up punting and doing something like this to make it work:

dojo.subscribe("/dojox/mobile/afterTransitionOut","v1",function(x) {if (-1 != x.toString().indexOf("v1"))dojo.byId("vid1").pause();}); 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜