tizen beta release
[framework/web/web-ui-fw.git] / libs / js / jquery-mobile-1.0.1pre / docs / _assets / js / jqm-docs.js
1 //set up the theme switcher on the homepage
2 $('div').live('pagecreate',function(event){
3         if( !$(this).is('.ui-dialog')){ 
4                 var appendEl = $(this).find('.ui-footer:last');
5                 
6                 if( !appendEl.length ){
7                         appendEl = $(this).find('.ui-content');
8                 }
9                 
10                 if( appendEl.is("[data-position]") ){
11                         return;
12                 }
13                 
14                 $('<a href="#themeswitcher" data-'+ $.mobile.ns +'rel="dialog" data-'+ $.mobile.ns +'transition="pop">Switch theme</a>')
15                         .buttonMarkup({
16                                 'icon':'gear',
17                                 'inline': true,
18                                 'shadow': false,
19                                 'theme': 'd'
20                         })
21                         .appendTo( appendEl )
22                         .wrap('<div class="jqm-themeswitcher">')
23                         .bind( "vclick", function(){
24                                 $.themeswitcher();
25                         });
26         }       
27
28 });
29
30 //collapse page navs after use
31 $(function(){
32         $('body').delegate('.content-secondary .ui-collapsible-content', 'click',  function(){
33                 $(this).trigger("collapse")
34         });
35 });
36
37 function setDefaultTransition(){
38         var winwidth = $( window ).width(),
39                 trans ="slide";
40                 
41         if( winwidth >= 1000 ){
42                 trans = "none";
43         }
44         else if( winwidth >= 650 ){
45                 trans = "fade";
46         }
47
48         $.mobile.defaultPageTransition = trans;
49 }
50
51
52 $(function(){
53         setDefaultTransition();
54         $( window ).bind( "throttledresize", setDefaultTransition );
55 });