diff --git a/public/src/client/topic.js b/public/src/client/topic.js index 63c63e3051..a73f884482 100644 --- a/public/src/client/topic.js +++ b/public/src/client/topic.js @@ -59,8 +59,8 @@ define('forum/topic', [ } addBlockQuoteHandler(); - addParentHandler(); + addDropupHandler(); navigator.init('[component="post"]', ajaxify.data.postcount, Topic.toTop, Topic.toBottom, Topic.navigatorCallback, Topic.calculateIndex); @@ -166,6 +166,17 @@ define('forum/topic', [ }); } + function addDropupHandler() { + // Locate all dropdowns + var target = $('#content .dropdown-menu').parent(); + + // Toggle dropup if past 50% of screen + $(target).on('show.bs.dropdown', function () { + var dropUp = this.getBoundingClientRect().top > ($(window).height() / 2); + $(this).toggleClass('dropup', dropUp); + }); + } + function updateTopicTitle() { var span = components.get('navbar/title').find('span'); if ($(window).scrollTop() > 50 && span.hasClass('hidden')) {