ginebra/chrome/js/ContextMenu.js
changeset 5 0f2326c2a325
parent 1 b0dd75e285d2
child 6 1c3b8676e58c
equal deleted inserted replaced
1:b0dd75e285d2 5:0f2326c2a325
     1 
       
     2    
       
     3 $(document).ready(function() {  
       
     4 
       
     5   //Get all the LI from the #tabMenu UL
       
     6   $('#tabMenu > li').click(function(){
       
     7 
       
     8     //perform the actions when it's not selected
       
     9     if (!$(this).hasClass('selected')) {    
       
    10         
       
    11         //remove the selected class from all LI    
       
    12         $('#tabMenu > li').removeClass('selected');
       
    13         
       
    14         //Reassign the LI
       
    15         $(this).addClass('selected');
       
    16         
       
    17         //Hide all the DIV in .boxBody
       
    18         $('.boxBody div').slideUp('1500');
       
    19         
       
    20         //Look for the right DIV in boxBody according to the Navigation UL index, therefore, the arrangement is very important.
       
    21         $('.boxBody div:eq(' + $('#tabMenu > li').index(this) + ')').slideDown('1500');
       
    22     }
       
    23     
       
    24   }).mouseover(function() {
       
    25     //Add and remove class, Personally I dont think this is the right way to do it, anyone please suggest    
       
    26     $(this).addClass('mouseover');
       
    27     $(this).removeClass('mouseout');   
       
    28     
       
    29   }).mouseout(function() {
       
    30     
       
    31     //Add and remove class
       
    32     $(this).addClass('mouseout');
       
    33     $(this).removeClass('mouseover');    
       
    34     
       
    35   });
       
    36 
       
    37   //Mouseover effect for menu list.
       
    38   $('.boxBody li').click(function(){
       
    39     window.snippets.ContextMenuId.hide();
       
    40   }).mouseover(function() {
       
    41     $(this).css('backgroundColor','#222');
       
    42     $(this).css('color','#fff');
       
    43   }).mouseout(function() {
       
    44     $(this).css('backgroundColor','');
       
    45     $(this).css('color','');
       
    46   });   
       
    47     
       
    48 });
       
    49