Skip to content

Commit 5465730

Browse files
committed
Added a CSS transition to the timestamp tooltip.
1 parent 5e4b586 commit 5465730

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

public/css/main.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,14 @@ html, body {
337337
width: 50px;
338338
text-align: center;
339339
padding: 4px 0;
340+
margin-left: -10px;
341+
-webkit-transition: opacity .25s ease-out, margin .25s ease-out;
342+
transition: opacity .25s ease-out, margin .25s ease-out;
343+
}
344+
345+
#timestamp-tooltip.active {
346+
margin-left: 0;
347+
opacity: 1;
340348
}
341349

342350
#timestamp-tooltip:after {

public/js/chat.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,28 +90,30 @@ define([], function() {
9090
};
9191

9292
Chat.prototype._handleMouseLeave = function(event) {
93-
this.timestampEl.style.opacity = 0;
93+
this.timestampEl.className = '';
9494
};
9595

9696
Chat.prototype._handleMouseOver = function(event) {
9797
var timestamp = event.target.dataset.timestamp || event.target.parentElement.dataset.timestamp,
9898
chatMessageEl = (event.target.dataset.timestamp) ? event.target : event.target.parentElement;
9999

100100
if (timestamp) {
101-
this.timestampEl.style.opacity = 1;
101+
if (this.timestampEl.className === '') {
102+
this.timestampEl.className = 'active';
103+
}
102104
this.timestampEl.innerHTML = timestamp;
103105

104106
var timestampTop = chatMessageEl.offsetTop - this.chatLogEl.scrollTop - 3,
105107
timestampLeft = chatMessageEl.offsetLeft - 50;
106108

107109
if (timestampTop < this.chatLogEl.offsetTop - 10) {
108-
this.timestampEl.style.opacity = 0;
110+
this.timestampEl.className = '';
109111
} else {
110112
this.timestampEl.style.top = chatMessageEl.offsetTop - this.chatLogEl.scrollTop - 3 + 'px';
111113
this.timestampEl.style.left = chatMessageEl.offsetLeft - 50 + 'px';
112114
}
113115
} else {
114-
this.timestampEl.style.opacity = 0;
116+
this.timestampEl.className = '';
115117
}
116118
};
117119

0 commit comments

Comments
 (0)