/** * Customizer order control. * * @package Neve\Customizer\Controls */ ( function ( $ ) { 'use strict'; wp.neveOrderControl = { init: function () { this.setupSorting(); this.handleHide(); }, setupSorting: function () { var self = this; $( '.ti-order-sortable' ).each( function () { $( this ).sortable( { revert: true, axis: 'y', containment: 'parent', update: function () { self.updateOrder( this ); }, } ); } ); }, updateOrder: function ( control ) { var value = []; var items = $( control ).find( 'li.enabled' ); $( items ).each( function () { value.push( $( this ).data( 'id' ) ); } ); value = value.filter(function( element ) { return element !== undefined; }); $( control ).next().val( JSON.stringify( value ) ); $( control ).next().trigger( 'change' ); }, handleHide: function () { var self = this; $( '.toggle-display' ).on( 'click touchstart', function () { $( this ).parent().toggleClass( 'enabled' ); self.updateOrder( $( this ).closest( '.ti-order-sortable' ) ); } ); } }; $( document ).ready( function () { wp.neveOrderControl.init(); } ); } )( jQuery );
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
button.js | File | 655 B | 0644 |
|
heading.js | File | 564 B | 0644 |
|
multi-select.js | File | 547 B | 0644 |
|
ordering.js | File | 1.18 KB | 0644 |
|
range.js | File | 3.94 KB | 0644 |
|
responsive-input.js | File | 1.79 KB | 0644 |
|
responsive-switchers.js | File | 2.6 KB | 0644 |
|
tabs.js | File | 5.42 KB | 0644 |
|
typography-extra.js | File | 233 B | 0644 |
|
upsell.js | File | 243 B | 0644 |
|