Blame view

bower_components/Materialize/js/buttons.js 1.4 KB
74249687   Luigi Serra   Cross browser con...
1
2
3
4
5
6
  (function ($) {
    $(document).ready(function() {
  
      // jQuery reverse
      $.fn.reverse = [].reverse;
  
c5169e0e   Renato De Donato   a new hope
7
      $(document).on('mouseenter.fixedActionBtn', '.fixed-action-btn', function(e) {
74249687   Luigi Serra   Cross browser con...
8
9
        var $this = $(this);
        openFABMenu($this);
c5169e0e   Renato De Donato   a new hope
10
  
74249687   Luigi Serra   Cross browser con...
11
12
      });
  
c5169e0e   Renato De Donato   a new hope
13
      $(document).on('mouseleave.fixedActionBtn', '.fixed-action-btn', function(e) {
a1a3bc73   Luigi Serra   graphs updates
14
        var $this = $(this);
c5169e0e   Renato De Donato   a new hope
15
        closeFABMenu($this);
a1a3bc73   Luigi Serra   graphs updates
16
17
      });
  
74249687   Luigi Serra   Cross browser con...
18
19
20
21
    });
  
    $.fn.extend({
      openFAB: function() {
c5169e0e   Renato De Donato   a new hope
22
23
        var $this = $(this);
        openFABMenu($this);
74249687   Luigi Serra   Cross browser con...
24
25
      },
      closeFAB: function() {
c5169e0e   Renato De Donato   a new hope
26
        closeFABMenu($this);
74249687   Luigi Serra   Cross browser con...
27
28
29
30
31
32
33
      }
    });
  
  
    var openFABMenu = function (btn) {
      $this = btn;
      if ($this.hasClass('active') === false) {
74249687   Luigi Serra   Cross browser con...
34
35
        $this.addClass('active');
        $this.find('ul .btn-floating').velocity(
c5169e0e   Renato De Donato   a new hope
36
          { scaleY: ".4", scaleX: ".4", translateY: "40px"},
74249687   Luigi Serra   Cross browser con...
37
38
39
          { duration: 0 });
  
        var time = 0;
c5169e0e   Renato De Donato   a new hope
40
        $this.find('ul .btn-floating').reverse().each(function () {
74249687   Luigi Serra   Cross browser con...
41
          $(this).velocity(
c5169e0e   Renato De Donato   a new hope
42
            { opacity: "1", scaleX: "1", scaleY: "1", translateY: "0"},
74249687   Luigi Serra   Cross browser con...
43
44
45
46
47
48
49
50
            { duration: 80, delay: time });
          time += 40;
        });
      }
    };
  
    var closeFABMenu = function (btn) {
      $this = btn;
74249687   Luigi Serra   Cross browser con...
51
52
53
54
      $this.removeClass('active');
      var time = 0;
      $this.find('ul .btn-floating').velocity("stop", true);
      $this.find('ul .btn-floating').velocity(
c5169e0e   Renato De Donato   a new hope
55
        { opacity: "0", scaleX: ".4", scaleY: ".4", translateY: "40px"},
74249687   Luigi Serra   Cross browser con...
56
57
58
59
60
61
        { duration: 80 }
      );
    };
  
  
  }( jQuery ));