src/materialize/materialize.js
function(btn) {
    if (btn.attr('data-open') !== "true") {
      return;
    }

    var offsetX, offsetY, scaleFactor;
    var windowWidth = window.innerWidth;
    var windowHeight = window.innerHeight;
    var btnWidth = btn.attr('data-origin-width');
    var btnBottom = btn.attr('data-origin-bottom');
    var btnLeft = btn.attr('data-origin-left');
    var anchor = btn.find('> .btn-floating').first();
    var menu = btn.find('> ul').first();
    var backdrop = btn.find('.fab-backdrop');
    var fabColor = anchor.css('background-color');

    offsetX = btnLeft - (windowWidth / 2) + (btnWidth / 2);
    offsetY = windowHeight - btnBottom;
    scaleFactor = windowWidth / backdrop.width();


    // Hide backdrop
    btn.removeClass('active');
    btn.attr('data-open', false);
    btn.css({
      'background-color': 'transparent',
      transition: 'none'
    });
    anchor.css({
      transition: 'none'
    });
    backdrop.css({
      transform: 'scale(0)',
      'background-color': fabColor
    });
    menu.find('> li > a').css({
      opacity: ''
    });

    setTimeout(function() {
      backdrop.remove();

      // Set initial state.
      btn.css({
        'text-align': '',
        width: '',
        bottom: '',
        left: '',
        overflow: '',
        'background-color': '',
        transform: 'translate3d(' + -offsetX + 'px,0,0)'
      });
      anchor.css({
        overflow: '',
        transform: 'translate3d(0,' + offsetY + 'px,0)'
      });

      setTimeout(function() {
        btn.css({
          transform: 'translate3d(0,0,0)',
          transition: 'transform .2s'
        });
        anchor.css({
          transform: 'translate3d(0,0,0)',
          transition: 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)'
        });
      }, 20);
    }, 200);
  }
function(btn) {
    if (btn.attr('data-open') !== "true") {
      return;
    }

    var offsetX, offsetY, scaleFactor;
    var windowWidth = window.innerWidth;
    var windowHeight = window.innerHeight;
    var btnWidth = btn.attr('data-origin-width');
    var btnBottom = btn.attr('data-origin-bottom');
    var btnLeft = btn.attr('data-origin-left');
    var anchor = btn.find('> .btn-floating').first();
    var menu = btn.find('> ul').first();
    var backdrop = btn.find('.fab-backdrop');
    var fabColor = anchor.css('background-color');

    offsetX = btnLeft - (windowWidth / 2) + (btnWidth / 2);
    offsetY = windowHeight - btnBottom;
    scaleFactor = windowWidth / backdrop.width();


    // Hide backdrop
    btn.removeClass('active');
    btn.attr('data-open', false);
    btn.css({
      'background-color': 'transparent',
      transition: 'none'
    });
    anchor.css({
      transition: 'none'
    });
    backdrop.css({
      transform: 'scale(0)',
      'background-color': fabColor
    });
    menu.find('> li > a').css({
      opacity: ''
    });

    setTimeout(function() {
      backdrop.remove();

      // Set initial state.
      btn.css({
        'text-align': '',
        width: '',
        bottom: '',
        left: '',
        overflow: '',
        'background-color': '',
        transform: 'translate3d(' + -offsetX + 'px,0,0)'
      });
      anchor.css({
        overflow: '',
        transform: 'translate3d(0,' + offsetY + 'px,0)'
      });

      setTimeout(function() {
        btn.css({
          transform: 'translate3d(0,0,0)',
          transition: 'transform .2s'
        });
        anchor.css({
          transform: 'translate3d(0,0,0)',
          transition: 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)'
        });
      }, 20);
    }, 200);
  }
function ( btn ) { if ( btn . attr ( 'data-open' ) !== "true" ) { return ; } var offsetX , offsetY , scaleFactor ; var windowWidth = window . innerWidth ; var windowHeight = window . innerHeight ; var btnWidth = btn . attr ( 'data-origin-width' ) ; var btnBottom = btn . attr ( 'data-origin-bottom' ) ; var btnLeft = btn . attr ( 'data-origin-left' ) ; var anchor = btn . find ( '> .btn-floating' ) . first ( ) ; var menu = btn . find ( '> ul' ) . first ( ) ; var backdrop = btn . find ( '.fab-backdrop' ) ; var fabColor = anchor . css ( 'background-color' ) ; offsetX = btnLeft - ( windowWidth / 2 ) + ( btnWidth / 2 ) ; offsetY = windowHeight - btnBottom ; scaleFactor = windowWidth / backdrop . width ( ) ; // Hide backdrop btn . removeClass ( 'active' ) ; btn . attr ( 'data-open' , false ) ; btn . css ( { 'background-color' : 'transparent' , transition : 'none' } ) ; anchor . css ( { transition : 'none' } ) ; backdrop . css ( { transform : 'scale(0)' , 'background-color' : fabColor } ) ; menu . find ( '> li > a' ) . css ( { opacity : '' } ) ; setTimeout ( function ( ) { backdrop . remove ( ) ; // Set initial state. btn . css ( { 'text-align' : '' , width : '' , bottom : '' , left : '' , overflow : '' , 'background-color' : '' , transform : 'translate3d(' + - offsetX + 'px,0,0)' } ) ; anchor . css ( { overflow : '' , transform : 'translate3d(0,' + offsetY + 'px,0)' } ) ; setTimeout ( function ( ) { btn . css ( { transform : 'translate3d(0,0,0)' , transition : 'transform .2s' } ) ; anchor . css ( { transform : 'translate3d(0,0,0)' , transition : 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)' } ) ; } , 20 ) ; } , 200 ) ; }
Transform toolbar back into FAB
@param  {Object}  object jQuery object
Transform toolbar back into FAB