diff options
Diffstat (limited to 'plugins/CoreHome/angularjs/selector/selector.directive.js')
-rw-r--r-- | plugins/CoreHome/angularjs/selector/selector.directive.js | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/plugins/CoreHome/angularjs/selector/selector.directive.js b/plugins/CoreHome/angularjs/selector/selector.directive.js index 37db1d5743..7779ce37a0 100644 --- a/plugins/CoreHome/angularjs/selector/selector.directive.js +++ b/plugins/CoreHome/angularjs/selector/selector.directive.js @@ -11,9 +11,9 @@ (function () { angular.module('piwikApp').directive('piwikExpandOnClick', piwikExpandOnClick); - piwikExpandOnClick.$inject = ['$document']; + piwikExpandOnClick.$inject = ['$document', 'piwik']; - function piwikExpandOnClick($document){ + function piwikExpandOnClick($document, piwik){ return { restrict: 'A', @@ -21,6 +21,12 @@ element.find('.title').on('click', function () { element.toggleClass('expanded'); + + var $position = element.find('.dropdown.positionInViewport'); + + if ($position.size()) { + piwik.helper.setMarginLeftToBeInViewport($position); + } }); function onClickOutsideElement (event) { @@ -47,9 +53,9 @@ angular.module('piwikApp').directive('piwikExpandOnHover', piwikExpandOnHover); - piwikExpandOnHover.$inject = ['$document']; + piwikExpandOnHover.$inject = ['$document', 'piwik']; - function piwikExpandOnHover($document){ + function piwikExpandOnHover($document, piwik){ return { restrict: 'A', @@ -57,6 +63,12 @@ element.on('mouseenter', '.title', function () { element.addClass('expanded'); + + var $position = element.find('.dropdown.positionInViewport'); + + if ($position.size()) { + piwik.helper.setMarginLeftToBeInViewport($position); + } }); element.on('mouseleave', function () { |