function fadeDown(el, options)
{
    // 0. default options
    options = Object.assign({}, { split: .6, speed: DEFAULT_SPEED }, options);

    // 1. work out how things are split
    let fFadeTime  = options.split * options.speed;
    let fSlideTime = options.speed - fFadeTime;

    // 2. create a dummy node of the appropriate height…
    // a. show our victim, so we can read a height
    el.style.display = null;

    // b. create the new element
    let elTmp = document.createElement('div');
    elTmp.classList.add('fx__tmp');
    elTmp.style.height  = `${el.clientHeight}px`;

    // c. hide our victim, and insert the temporary element
    el.style.display = 'none';
    el.parentNode.insertBefore(elTmp, el);

    // d. trigger the slide animation
    return new Promise(resolve =>
    {
        slideDown(elTmp, fSlideTime).then(() =>
        {
            // a. remove our temporary element and show the real one
            elTmp.parentNode.removeChild(elTmp);
            el.style.display = null;

            // b. fade it in!
            fadeIn(el, fFadeTime).then(resolve);
        });
    })
}
/**
 * Reverse effect of fadeUp, above.
 *
 * @param   {HTMLElement} el - the unfortunate victim
 * @param   {Object} options - an optional object containing speed/proportion options
 * @return  {Promise} a Promise that is resolved when the effect completes
 */
Reverse effect of fadeUp, above.
@param   {HTMLElement} el - the unfortunate victim
@param   {Object} options - an optional object containing speed/proportion options
@return  {Promise} a Promise that is resolved when the effect completes
Reverse effect of fadeUp above . @param { HTMLElement } el - the unfortunate victim @param { Object } options - an optional object containing speed / proportion options @return { Promise } a Promise that is resolved when the effect completes
function fadeDown(el, options)
{
    options = Object.assign({}, { split: .6, speed: DEFAULT_SPEED }, options);
    let fFadeTime  = options.split * options.speed;
    let fSlideTime = options.speed - fFadeTime;
    el.style.display = null;
    let elTmp = document.createElement('div');
    elTmp.classList.add('fx__tmp');
    elTmp.style.height  = `${el.clientHeight}px`;
    el.style.display = 'none';
    el.parentNode.insertBefore(elTmp, el);
    return new Promise(resolve =>
    {
        slideDown(elTmp, fSlideTime).then(() =>
        {
            elTmp.parentNode.removeChild(elTmp);
            el.style.display = null;
            fadeIn(el, fFadeTime).then(resolve);
        });
    })
}
function fadeDown ( el , options ) { options = Object . assign ( { } , { split : .6 , speed : DEFAULT_SPEED } , options ) ; let fFadeTime = options . split * options . speed ; let fSlideTime = options . speed - fFadeTime ; el . style . display = null ; let elTmp = document . createElement ( 'div' ) ; elTmp . classList . add ( 'fx__tmp' ) ; elTmp . style . height = ` ${ el . clientHeight } ` ; el . style . display = 'none' ; el . parentNode . insertBefore ( elTmp , el ) ; return new Promise ( resolve => { slideDown ( elTmp , fSlideTime ) . then ( ( ) => { elTmp . parentNode . removeChild ( elTmp ) ; el . style . display = null ; fadeIn ( el , fFadeTime ) . then ( resolve ) ; } ) ; } ) }
Reverse effect of fadeUp, above.
Reverse effect of fadeUp above .
// 0. default options // 1. work out how things are split // 2. create a dummy node of the appropriate height… // a. show our victim, so we can read a height // b. create the new element // c. hide our victim, and insert the temporary element // d. trigger the slide animation // a. remove our temporary element and show the real one // b. fade it in!