Allow specifying a dedicated overflow container in WoltLabSuite/Core/Bbcode/Collapsible
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 3 Jun 2020 16:18:33 +0000 (18:18 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 3 Jun 2020 16:18:33 +0000 (18:18 +0200)
wcfsetup/install/files/js/WoltLabSuite/Core/Bbcode/Collapsible.js

index 7f6416ce7faccbdbf5babc39d865feaf7d12013e..a691f67a7dbbaf579db755e1c29dcbd75592aade 100644 (file)
@@ -16,7 +16,7 @@ define([], function() {
         */
        return {
                observe: function() {
-                       var container, toggleButtons;
+                       var container, toggleButtons, overflowContainer;
                        while (_containers.length) {
                                container = _containers[0];
                                
@@ -28,6 +28,7 @@ define([], function() {
                                                toggleButtons.push(button);
                                        }
                                });
+                               overflowContainer = elBySel('.collapsibleBbcodeOverflow', container) || container;
                                
                                if (toggleButtons.length > 0) {
                                        (function (container, toggleButtons) {
@@ -74,10 +75,10 @@ define([], function() {
                                                });
                                                
                                                // expand boxes that are initially scrolled
-                                               if (container.scrollTop !== 0) {
+                                               if (overflowContainer.scrollTop !== 0) {
                                                        toggle();
                                                }
-                                               container.addEventListener('scroll', function () {
+                                               overflowContainer.addEventListener('scroll', function () {
                                                        if (container.classList.contains('collapsed')) {
                                                                toggle();
                                                        }