/**
 * Custom scripts for Heading Toggle Control
 *
 * @package Purenote
 */

( function( api, $ ) {
    api.controlConstructor['mt-heading-toggle'] = api.Control.extend( {
        ready: function() {
            var control = this, container = control.container;
            // on trigger action
            container.on( "click", function() {
                var _this = $(this);
                _this.find(".toggle-button .dashicons").toggleClass("dashicons-arrow-down-alt2 dashicons-arrow-up-alt2");
                _this.nextUntil( ".customize-control-mt-heading-toggle" ).slideToggle();
            })
        }
    });
} )( wp.customize, jQuery );
