-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Make dropdown menu go upwards if it is at the bottom of the browser window #1317
Comments
Maybe (similar to tooltips) it would be good to have an optional "where" option which defaults to down, but could be overridden? |
You're talking about the "tooltip-placement" attribute right? The problem is this is still pretty static... What I'd like to implement is a solution which dynamically decides whether the dropdown is rendered upwards or downwards. But I don't know how to do this. |
The "dynamic decision" solution sounds nice, but I'm going to guess it's complicated, since this issue is quite dormant. Too bad there is still no solution to this. 😦 |
Makes dropdown menu go upwards if it's at the bottom of the browser window. Moves DOM logic to directive. CLoses angular-ui#1317
Could this be fixed by modifying the $position service to behave more like the jquery-ui position, which takes the viewport into account? http://api.jqueryui.com/position/ Somewhat related to #3820 -- I could fix that by changing the $position call to look for dropdown-menu-right and position accordingly, but if $position was smarter that would take care of the dropup behavior as well. |
Makes dropdown menu go upwards if it's at the bottom of the browser window. Moves DOM logic to directive. CLoses angular-ui#1317
There's definitely a usability problem with dropdowns that drop down at the bottom of the page or drop up at the top of the page. I'm in a situation where I can't easily just arbitrarily pick up or down because I have a set of dropdowns that could be found at the top of the browser or the bottom, depending on what other data is loaded (the quantity of which will always be variable). So, functionality that could make an intelligent decision on that would be really useful. |
I had to have this functionality in order to have a good user experience with dropdowns that could be located all over the window. So I created a controller to handle this. http://plnkr.co/edit/wzrfiP0vsvgkg3McUvh0?p=preview Requires jQuery in order to find the child ul that contains all of the dropdown menu options. When a dropdown hooked into the DropupController is clicked, the toggle method will check the dropdown's position in the window, the height of the dropdown container div, and the height of the dropdown menu ul element. It will also determine the window height. Then it calculates if there's room to drop up and if there's room to drop down. If (yes and no), then it will drop up. Else, it will drop down. This can be plugged into any dropdown on a page and each dropdown will act independently of each other. So, some long dropdowns could drop up while other shorter dropdowns on the same row could drop down. Each dropdown needs the DropupController initialized in it's parent container - div, td, whatever. If there's 4 dropdowns on a page, then you need to initialize DropupController 4 times. I spent way too much time creating this functionality, so I'm sharing it to hopefully alleviate that time sink for others. If someone could figure out how to break the dependency on jQuery, that'd be great. I don't mind, since I'm using jQuery in my applications anyway. |
Closing in favor of #4762. |
I want dropdown menu position dynamic. i mean based on window position. if there is no space in right it should move automatically left. same as top and bottom. Any one please help me. please provide fiddle or codepen link... |
@Ellesedil reused your code in "scope.$watch('isOpen', function (isOpen, wasOpen) {" part and tweaked it a little bit it to fix this issue temporarily (drop-up).
here is full section `scope.$watch('isOpen', function (isOpen, wasOpen) {
a snapshot is here Note: I'm using ui-bootstrap-tpls-1.3.2 version. |
I managed it in dropdown's button onclick event to manage horizontal aligning :
|
Dear all!
We're having a little issue with dropdowns. We're using dropdown menus tables (context menus). As you can see in the fiddle below, the dropdown menus of the rows at the bottom of the browser window are not completely visible (you would have to use your scrolling wheel to see the whole menu).
http://jsfiddle.net/mhu23/YZx7R/22/
What I learned from bootstrap was that you can use the class "dropup" to open the menus upwards (see code comment in fiddle). But now I'm stuck implementing an intelligent solution. Should I create a directive which dynamically adds the class dropup? But how do I decide if the menu is "rendered" outside the view scope?
Thanks a lot for your help!
Michael
The text was updated successfully, but these errors were encountered: