From 5487ddebc2c0fff66450b27b554af525f7ef2cc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Sch=C3=A4ffer?= Date: Sun, 7 Jun 2015 18:51:11 -0300 Subject: Implemented floatlabels for input fields when composing email --- web-ui/app/js/mail_view/ui/compose_box.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'web-ui/app/js/mail_view/ui/compose_box.js') diff --git a/web-ui/app/js/mail_view/ui/compose_box.js b/web-ui/app/js/mail_view/ui/compose_box.js index 1b209b23..1b17e5a3 100644 --- a/web-ui/app/js/mail_view/ui/compose_box.js +++ b/web-ui/app/js/mail_view/ui/compose_box.js @@ -57,6 +57,26 @@ define( this.select('recipientsFields').show(); this.on(this.select('closeButton'), 'click', this.showNoMessageSelected); this.enableAutoSave(); + + function floatlabelHandler(element) { + $(function() { + var showClass = "showfloatlabel"; + $(element).bind("checkval", function() { + var label = $(this).prev("label"); + if (this.value !== "") { + label.addClass(showClass); + $(this).addClass(showClass); + } else { + label.removeClass(showClass); + $(this).removeClass(showClass); + } + }).on("keyup",function() { + $(this).trigger("checkval"); + }).trigger("checkval"); + }); + } + floatlabelHandler("input.floatlabel"); + floatlabelHandler("textarea.floatlabel"); }; this.mailDeleted = function(event, data) { -- cgit v1.2.3