summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mannehed <samuel@cendio.se>2018-03-08 16:52:53 +0100
committerSamuel Mannehed <samuel@cendio.se>2018-03-08 16:52:53 +0100
commit06309160ee25b7b99c96008f3d4d28933b097715 (patch)
tree7208432a473b1a5aad8254721f81a1175d9272ae
parentd7a575a2c8e3b75ac10003935d5d46ccc302b0a9 (diff)
downloadnovnc-06309160ee25b7b99c96008f3d4d28933b097715.tar.gz
Only disable animation when element is displayed
The transitionend event will not fire when display=none. This can prevent the initial animation for hiding the controlbar in some cases.
-rw-r--r--app/ui.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/app/ui.js b/app/ui.js
index 592dfcf..4e301d4 100644
--- a/app/ui.js
+++ b/app/ui.js
@@ -549,10 +549,15 @@ var UI = {
},
toggleControlbarSide: function () {
- // Temporarily disable animation to avoid weird movement
+ // Temporarily disable animation, if bar is displayed, to avoid weird
+ // movement. The transitionend-event will not fire when display=none.
var bar = document.getElementById('noVNC_control_bar');
- bar.style.transitionDuration = '0s';
- bar.addEventListener('transitionend', function () { this.style.transitionDuration = ""; });
+ var barDisplayStyle = window.getComputedStyle(bar).display;
+ if (barDisplayStyle !== 'none') {
+ bar.style.transitionDuration = '0s';
+ bar.addEventListener('transitionend', function () {
+ this.style.transitionDuration = ""; });
+ }
var anchor = document.getElementById('noVNC_control_bar_anchor');
if (anchor.classList.contains("noVNC_right")) {