reports: Fix id of custom date selector
[ninja.git] / application / media / js / jmenu.js
blobc7c9bb8e0f1bcafdac10f51d7fe838d32b8bc4ea
1 /*
2 jQuery menu
4 Example:
5 $(document).ready(function()
7     $('#jmenu').jmenu({animation:'fade',duration:100});
8 });
10 (c) 2010 Sawanna Team (http://sawanna.org)
13 var jmenu={
14     effect: 'fade',           /* default animation effect */
15     duration: 400,         /* default duration */
16     set: function (settings)
17     {
18        try
19         {
20             if (settings.animation == 'show') { this.effect='show'; }
21             if (settings.animation == 'slide') { this.effect='slide'; }
22             if (settings.animation == 'fade') { this.effect='fade'; }
23         } catch (e) {}
25         try
26         {
27             this.duration=settings.duration;
28         } catch (e) {}
29     },
30     fix_pos:function(elem)
31     {
32         if ($(elem).parent('ul').parent('li').length)
33         {
34             $(elem).children('ul').eq(0).css({marginTop:-$(elem).height(),marginLeft:$(elem).width()});
35         } else
36         {
37                 // Changes by Per � 2011-07:
38             //$(elem).children('ul').eq(0).css({'top':$(elem).offset().top+$(elem).height(),'left':$(elem).offset().left});
39             $(elem).children('ul').eq(0).css({'top':'15px','left':$(elem).offset().left});
40             // make sure that the warning message doesn't appear on top of menu
41         }
42     },
43     show:function(elem)
44     {
45         if (this.effect=='fade') { $(elem).children('ul').eq(0).stop(1,1).fadeIn(this.duration); }
46         else if (this.effect=='slide') {$(elem).children('ul').eq(0).stop(1,1).slideDown(this.duration); }
47         else if (this.effect=='show') { $(elem).children('ul').eq(0).stop(1,1).show(this.duration); }
48     },
49     hide: function(elem)
50     {
51         $(elem).children('ul').eq(0).stop(1,1).fadeOut(100);
52     }
55 jQuery.fn.jmenu=function(settings)
57     jmenu.set(settings);
59     $(this).find('li').each(function()
60     {
61             $(this).hover(
62                 function()
63                 {
64                     jmenu.fix_pos(this);
65                     jmenu.show(this);
66                 },
67                 function()
68                 {
69                     jmenu.hide(this);
70                 }
71             );
72     });