expand-options.js (1353B)
1 (function( $ ) { 2 'use strict'; 3 4 $.redux = $.redux || {}; 5 6 $.redux.expandOptions = function( parent ) { 7 var trigger = parent.find( '.expand_options' ); 8 var width = parent.find( '.redux-sidebar' ).width() - 1; 9 var id = $( '.redux-group-menu .active a' ).data( 'rel' ) + '_section_group'; 10 11 if ( trigger.hasClass( 'expanded' ) ) { 12 trigger.removeClass( 'expanded' ); 13 parent.find( '.redux-main' ).removeClass( 'expand' ); 14 15 parent.find( '.redux-sidebar' ).stop().animate( 16 { 'margin-left': '0px' }, 17 500 18 ); 19 20 parent.find( '.redux-main' ).stop().animate( 21 { 'margin-left': width }, 22 500, 23 function() { 24 parent.find( '.redux-main' ).attr( 'style', '' ); 25 } 26 ); 27 28 parent.find( '.redux-group-tab' ).each( 29 function() { 30 if ( $( this ).attr( 'id' ) !== id ) { 31 $( this ).fadeOut( 'fast' ); 32 } 33 } 34 ); 35 36 // Show the only active one. 37 } else { 38 trigger.addClass( 'expanded' ); 39 parent.find( '.redux-main' ).addClass( 'expand' ); 40 41 parent.find( '.redux-sidebar' ).stop().animate( 42 { 'margin-left': - width - 113 }, 43 500 44 ); 45 46 parent.find( '.redux-main' ).stop().animate( 47 { 'margin-left': '-1px' }, 48 500 49 ); 50 51 parent.find( '.redux-group-tab' ).fadeIn( 52 'medium', 53 function() { 54 $.redux.initFields(); 55 } 56 ); 57 } 58 59 return false; 60 }; 61 })( jQuery );