Sha256: a25afce4962063c4387f5367a5eae09c0ccf895b5ebc846e5d2a81463f93dde9

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

$(document).on('turbolinks:load', function() {
  var action_alert = $('.action-alert');
  var action_alert_count = action_alert.length;

  setTimeout(function() {
    if (action_alert_count !== 0) {
      var temp_height = 0;
      for (var i = 1; i <= action_alert_count; i ++) {
        var alert = $('.action-alert:nth-of-type(' + i + ')');
        alert.animate({bottom: i + temp_height + 'rem'});
        temp_height += parseFloat(alert.css('height')) / 10;
      }

      // $("#action_alert_audio")[0].play();
    }
  }, 200);
});


$(document).on('click', '.action-alert-close', function() {
  var alert = $(this).parent('.action-alert');
  var select_bottom = parseFloat(alert.css('bottom')) / 10;
  var select_height = parseFloat(alert.css('height')) / 10;
  alert.animate({bottom: -1 * select_height - 5 + 'rem'});

  var action_alert = $('.action-alert');
  $.each(action_alert, function() {
    var bottom = parseFloat($(this).css('bottom')) / 10;
    if (bottom > select_bottom ) {
      $(this).animate({bottom: bottom - select_height - 1 + 'rem'});
    }
  });
});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tmatt_cms-0.1.9 lib/generators/tmatt_cms/templates/js/utils/action_alert.js
tmatt_cms-0.1.8 lib/generators/tmatt_cms/templates/js/utils/action_alert.js