collapsible: Add collapse/expand animation (VI)
[platform/framework/web/web-ui-fw.git] / src / themes / tizen / tizen-white / theme.js
1 (function( $, undefined ) {
2 //$.mobile.page.prototype.options.backBtnTheme  = "s";
3
4 // Clear default theme for child elements
5 $( function ( o ) {
6         o.headerTheme = "s";
7         o.footerTheme = "s";
8 } ( $.mobile.page.prototype.options ) );
9
10 // clear listview
11 ( function ( o ) {
12         o.theme = "s";
13         o.countTheme = "s";
14         o.headerTheme = "s";
15         o.dividerTheme = "s";
16         o.splitTheme = "s";
17 } ( $.mobile.listview.prototype.options ) );
18
19 // Collapsible
20 ( function ( o ) {
21         o.heading = o.heading + ',li';          // Add listitem as a heading
22         o.inset = false;
23         o.iconPos = "right";    // Move iconPos to right position
24         o.collapsedIcon = "arrow-u";
25         o.expandedIcon = "arrow-d";
26         o.animation = true;
27         o.customEventHandler = function ( isCollapse ) {
28                 var self = this,
29                         c = $(self).children('.ui-collapsible-content')[0],
30
31                 function _getHeight( el ) {
32                         var h = 0,
33                                 heading = $( el ).children('.ui-collapsible-heading')[0],
34                                 content = $( el ).children('.ui-collapsible-content')[0];
35
36                         h += heading.clientHeight;
37                         $( content ).children().each ( function ( idx, _el ) {
38                                 if ( $( _el ).hasClass( 'ui-collapsible' ) ) {  // recursive call for nested collapsible list
39                                         h += _getHeight( _el );
40
41                                 } else {
42                                         h += _el.clientHeight;
43                                 }
44                         } );
45                         return h;
46                 }
47
48                 if ( isCollapse ) {
49                         $( c ).data( 'max-height', _getHeight( self ) );
50                 } else {
51                         if ( ! $( c ).data( 'max-height' ) ) {
52                                 $( c ).data( 'max-height', document.body.clientHeight );
53                         }
54                         $( c ).css( 'max-height', $( c ).data( 'max-height' ) );
55                 }
56         };
57 } ( $.mobile.collapsible.prototype.options ) );
58
59 //clear button theme
60 $.mobile.button.prototype.options.theme = "s";
61 $.fn.buttonMarkup.defaults.theme = "s";
62
63 // Default theme swatch
64 $.mobile.page.prototype.options.theme = "s";
65
66 // Original scale of the theme
67 $.tizen.frameworkData.defaultViewportWidth = 360;       // Fit to device-width
68 $.tizen.frameworkData.defaultFontSize = 22;
69
70 })(jQuery);