Tizen 2.1 base
[platform/framework/web/web-ui-fw.git] / demos / tizen-gray / widgets / progressbar.js
1         $('#progressbar-demo').live('pageshow', function (e) {
2
3                 // set progressbar value...
4                 $('#progressbar').progressbar("option", "value", 37);
5
6                 // how to update progressbar..
7                 $('#progressbarTest').bind('vclick', function (e) {
8
9                         // request animation frame
10                         window.requestAnimFrame = (function(){
11                                 return  window.requestAnimationFrame       ||
12                                 window.webkitRequestAnimationFrame ||
13                                 window.mozRequestAnimationFrame    ||
14                                 window.oRequestAnimationFrame      ||
15                                 window.msRequestAnimationFrame     ||
16                                 function(animloop){
17                                 return window.setTimeout(animloop, 1000 / 60);
18                                 };
19                         })();
20                         window.cancelRequestAnimFrame = ( function() {
21                                 return window.cancelAnimationFrame          ||
22                                 window.webkitCancelRequestAnimationFrame    ||
23                                 window.mozCancelRequestAnimationFrame       ||
24                                 window.oCancelRequestAnimationFrame     ||
25                                 window.msCancelRequestAnimationFrame        ||
26                                 clearTimeout
27                         })();
28
29                         // to store the request
30                         var request;
31                         // progress value
32                         var i = 0;
33
34                         // start and run the animloop
35                         (function animloop(){
36                                 $('#progressbar').progressbar("option", "value", i++);
37                                 request = requestAnimFrame(animloop);
38                                 if ( i > 100 )
39                                         cancelRequestAnimFrame(request);
40                         })();
41                 });
42                 $(this).find('#pending').progress({ running: true });
43                 $(this).find('#progressing').progress({ running: true });
44
45                 $('#pendingTest').bind('vclick', function (e) {
46                         var running = $('#pending').progress( "option", "running" );
47                         // start/stop progressing animation
48                         $('#pending').progress( "option", "running", !running );
49                 });
50
51                 $('#progressingTest').bind('vclick', function (e) {
52                         var running = $('#progressing').progress( "option", "running" );
53                         // start/stop progressing animation
54                         $('#progressing').progress( "option", "running", !running );
55                 });
56         });
57
58         $('#progressbar-demo').bind('pagehide', function (e) {
59                 $(this).find('#pending').progress( "option", "running", false );
60                 $(this).find('#progressing').progress( "option", "running", false );
61         });
62
63