HomeHelpTrac

Changeset 15845 for trunk


Ignore:
Timestamp:
01/07/12 20:17:43 (5 months ago)
Author:
Alexander Trofimov
Message:

Switcher - allow manual changing of switcher element

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/inc/js/jquery.webForms.js

    r15798 r15845  
    1515        $('.bx-switcher-cont', this).each(function() { 
    1616            var eSwitcher = $(this); 
     17            var eInput = $(this).find('input'); 
    1718 
    1819            if (eSwitcher.hasClass('bx-form-switcher-processed')) 
     
    2627                    $this.removeClass('on').addClass('off'); 
    2728                } else { 
     29                    $this.removeClass('off').addClass('on'); 
    2830                    $this.find('input').attr('checked', 'checked').trigger('change'); 
    29                     $this.removeClass('off').addClass('on'); 
    3031                } 
    3132                return false; 
     33            }); 
     34 
     35            eInput.on('enable', function () { 
     36                if ('checked' != $(this).attr('checked')) { 
     37                    console.log('onEnable'); 
     38                    $(this).attr('checked', 'checked').trigger('change'); 
     39                } 
     40                if (!eSwitcher.hasClass('on')) 
     41                    eSwitcher.removeClass('off').addClass('on'); 
     42            }); 
     43 
     44            eInput.on('disable', function () { 
     45                if (undefined != $(this).attr('checked')) { 
     46                    console.log('onDisable'); 
     47                    $(this).removeAttr('checked').trigger('change'); 
     48                } 
     49                if (!eSwitcher.hasClass('off')) 
     50                    eSwitcher.removeClass('on').addClass('off'); 
    3251            }); 
    3352        }); 
Note: See TracChangeset for help on using the changeset viewer.