1( function( $ ) { 2 3 "use strict"; 4 5 var AccordionHandler = function ( $scope, $ ) { 6 var accordionTitle = $scope.find('.trx-addons-accordion-tab-title'), 7 elementSettings = trx_addons_elementor_get_settings( $scope ), 8 accordionType = elementSettings.accordion_type, 9 accordionSpeed = elementSettings.toggle_speed; 10 11 // Open default actived tab 12 accordionTitle.each( function () { 13 var $self = $(this); 14 if ( $self.hasClass('trx-addons-accordion-tab-active-default') ) { 15 $self.addClass('trx-addons-accordion-tab-show trx-addons-accordion-tab-active'); 16 $self.next().slideDown( accordionSpeed ); 17 } 18 } ); 19 20 // Remove multiple click event for nested accordion 21 accordionTitle.off( 'click' ); // was .unbind( 'click' ); 22 23 accordionTitle.on( 'click keypress', function( e ) { 24 e.preventDefault(); 25 26 var validClick = ( e.which == 1 || e.which == 13 || e.which == 32 || e.which == undefined ) ? true : false; 27 28 if ( ! validClick ) { 29 return; 30 } 31 32 var $self = $(this), 33 $item = $self.parent(), 34 container = $self.closest('.trx-addons-accordion'), 35 item = $self.closest('.trx-addons-accordion-item'), 36 title = container.find('.trx-addons-accordion-tab-title'), 37 content = container.find('.trx-addons-accordion-tab-content'); 38 39 $(document).trigger('trx-addons-accordion-switched', [$item]); 40 41 if (accordionType === 'accordion') { 42 title.removeClass('trx-addons-accordion-tab-active-default'); 43 content.removeClass('trx-addons-accordion-tab-active-default'); 44 45 if ( $self.hasClass( 'trx-addons-accordion-tab-show' ) ) { 46 item.removeClass('trx-addons-accordion-item-active'); 47 $self.removeClass('trx-addons-accordion-tab-show trx-addons-accordion-tab-active'); 48 $self.attr('aria-expanded', 'false'); 49 $self.next().slideUp( accordionSpeed ); 50 } else { 51 container.find('.trx-addons-accordion-item').removeClass('trx-addons-accordion-item-active'); 52 title.removeClass('trx-addons-accordion-tab-show trx-addons-accordion-tab-active'); 53 content.slideUp( accordionSpeed ); 54 $self.toggleClass('trx-addons-accordion-tab-show trx-addons-accordion-tab-active'); 55 title.attr('aria-expanded', 'false'); 56 item.toggleClass('trx-addons-accordion-item-active'); 57 if ( $self.hasClass( 'trx-addons-accordion-tab-title' ) ) { 58 $self.attr('aria-expanded', 'true'); 59 } 60 $self.next().slideToggle( accordionSpeed, function() { 61 var $content = $(this); 62 $(document).trigger( 'action.activate_accordion_tab', [$content] ); 63 $(document).trigger( 'action.init_hidden_elements', [$content] ); 64 // Way 1: works only with our handlers 65 $(document).trigger( 'action.resize_trx_addons' ); 66 } ); 67 } 68 } else { 69 // For acccordion type 'toggle' 70 if ( $self.hasClass( 'trx-addons-accordion-tab-show' ) ) { 71 $self.removeClass('trx-addons-accordion-tab-show trx-addons-accordion-tab-active'); 72 $self.next().slideUp( accordionSpeed ); 73 } else { 74 $self.addClass('trx-addons-accordion-tab-show trx-addons-accordion-tab-active'); 75 $self.next().slideDown( accordionSpeed, function() { 76 var $content = $(this); 77 $(document).trigger( 'action.activate_accordion_tab', [$content] ); 78 $(document).trigger( 'action.init_hidden_elements', [$content] ); 79 // Way 1: works only with our handlers 80 $(document).trigger( 'action.resize_trx_addons' ); 81 } ); 82 } 83 } 84 } ); 85 86 // Trigger filter by hash parameter in URL. 87 accordion_hashchange(); 88 89 // Trigger filter on hash change in URL. 90 $( window ).on( 'hashchange', function () { 91 accordion_hashchange(); 92 } ); 93 }; 94 95 function accordion_hashchange() { 96 if ( location.hash && $( location.hash ).length > 0 ) { 97 var element = $( location.hash + '.trx-addons-accordion-tab-title' ); 98 99 if ( element && element.length > 0 ) { 100 location.href = '#'; 101 $( 'html, body' ).animate( { 102 scrollTop: ( element.parents('.trx-addons-accordion-item').offset().top - 50) + 'px' 103 }, 500, function () { 104 if ( ! element.parents( '.trx-addons-accordion-item').hasClass('trx-addons-accordion-item-active' ) ) { 105 element.trigger( 'click' ); 106 } 107 } ); 108 } 109 } 110 } 111 112 $( window ).on( 'elementor/frontend/init', function () { 113 elementorFrontend.hooks.addAction( 'frontend/element_ready/trx_elm_accordion.default', AccordionH
113andler ); 114 } ); 115 116}( jQuery ) );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.