view sites/all/themes/omega/js/omega.messages.js @ 0:ff03f76ab3fe

initial version
author danieleb <danielebarchiesi@me.com>
date Wed, 21 Aug 2013 18:51:11 +0100
parents
children
line wrap: on
line source
(function ($, Drupal) {

  'use strict';

  /**
   * Adds a 'close' link on messages that allows them to be discarded.
   */
  Drupal.behaviors.omegaCloseableMessages = {
    attach: function (context) {
      $('.messages', context).once('closeable-messages', function () {
        $('<a href="#" class="close-message"></a>').click(function () {
          $(this).closest('.messages').fadeOut(function () {
            $(this).remove();
          });

          return false;
        }).appendTo(this);
      });
    }
  };

})(jQuery, Drupal);