From fca95d9b7921ab4647ee66bf097e3bad7fa87a8f Mon Sep 17 00:00:00 2001 From: Mattias Erming Date: Fri, 13 Jun 2014 16:23:37 +0200 Subject: [PATCH] Swipe/click chat to toggle sidebar. Close #9 --- client/js/chat.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/client/js/chat.js b/client/js/chat.js index 5dbaa5a6..64c56c0a 100644 --- a/client/js/chat.js +++ b/client/js/chat.js @@ -255,9 +255,17 @@ $(function() { if (touchDevice) { toggle = "touchstart"; } - chat.on(toggle, ".lt, .rt", function() { + + chat.on(toggle, ".lt, .rt", function(e) { var btn = $(this); viewport.toggleClass(btn.attr("class")); + if (viewport.hasClass("lt")) { + e.stopPropagation(); + viewport.find("#main").one(toggle, function(e) { + viewport.removeClass("lt"); + }); + } + }); function toArray(val) {