diff --git a/umbraco/presentation/umbraco_client/splitbutton/jquery.splitbutton.js b/umbraco/presentation/umbraco_client/splitbutton/jquery.splitbutton.js index d024edebcb..295a1c605b 100644 --- a/umbraco/presentation/umbraco_client/splitbutton/jquery.splitbutton.js +++ b/umbraco/presentation/umbraco_client/splitbutton/jquery.splitbutton.js @@ -484,4 +484,47 @@ return $.extend({}, $.fn.linkbutton.parseOptions(_11), { menu: t.attr("menu"), duration: t.attr("duration") }); }; $.fn.splitbutton.defaults = $.extend({}, $.fn.linkbutton.defaults, { plain: true, menu: null, duration: 100 }); -})(jQuery); +})(jQuery); + +function applySplitButtonOverflow(containerId, innerId, menuId, itemCssSelector, buttonId) { + //hack for the dropdown scrill + jQuery("
").appendTo("#" + menuId); + jQuery(itemCssSelector).each(function () { + jQuery("#" + innerId).append(this); + }); + + //only needed when we need to add scroll to macro menu + var maxHeight = 500; + var menu = jQuery("#" + menuId); + var container = jQuery("#" + containerId); + var menuHeight = menu.height(); + + if (menuHeight > maxHeight) { + jQuery("").appendTo("#" + menuId); + menu.css({ + height: maxHeight, + overflow: "hidden" + }) + container.css({ + height: maxHeight - 20, + overflow: "hidden" + }); + var interval; + jQuery("#" + buttonId).hover(function (e) { + interval = setInterval(function () { + var offset = jQuery("#" + innerId).offset(); + var currentTop = jQuery("#" + innerId).css("top").replace("px", ""); + if (Number(currentTop) > -(menuHeight - 40)) { + jQuery("#" + innerId).css("top", currentTop - 20); + } + }, 125); + }, function () { + clearInterval(interval); + }); + + jQuery("#" + buttonId).hover(function (e) { + jQuery("#" + innerId).css("top", 0) + }); + } + +} \ No newline at end of file