-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Position incorrect when on fixed elements #13
Comments
Hey @MattShrider, I just took a look at your proposed PR. The specific problem you encountered exists only if the container is in a fixed positioned element. Placing the So this reduces our problem to situations where you have the AC container within a fixed positioned container. I've set up an example here with all situations. As you can see the situation where the AC-container is within a fixed positioned element does not position correctly. I though of setting the AC container to relative but then any fixed input within that container will not position properly (I also assume that this is the common use case). I know that other libraries solve this by appending the menu to the element's container. I would like to avoid that if possible. Do you have any suggestions ? Thanks, Haki. |
I'm Using ngDialog a ngmodule to open modals windows It is possible to solve the problem by changing the position in the script You can see in the plunker |
Hey @elifio, I'm a bit time constrained at the moment so if anyone wants to take a crack at this i would appreciate it. Haki. |
Hi! I think we shouldn't calculate position of dropdown dynamically. /* fix styles */
[mass-autocomplete] {
position: relative;
}
.ac-container {
position: absolute;
top: 100% !important;
left: 0 !important;
width: 100% !important;
} What do you think about that? |
Thanks @psdcoder. Imo it's perfect solution. I don't see reason to use JS for positioning, when there is still additional container required. There should be information in documentation, that container have to be exactly in size of input. @hakib, How about this one? I know, a lot more (mass-autocomplete) directives, but more bulletproof solution, and less js calculations. |
@hakib Thanks for taking the time to explain this one, I moved the Cheers |
Tried everything didnt worked as expected. ´ ´ ´
´ ´ What's New<textarea class="form-control vresize" rows="5" placeholder="Update your status, the first phrase before break will be your title post." ng-model="description" required my-maxlength="1024"></textarea>
ps: its bootstrap classes. |
I'm using Foundation with AngularJS 1.4.8 and had similar issues with positioning but I wasn't attaching to a fixed element. The CSS suggested by @psdcoder helped me fix the issue. Perhaps this could be added to the docs in the future. Thanks for the great plugin! |
Thanks @psdcoder your code works for me. |
Removing following lines when used inside a modal worked for me:
|
I just pushed v0.3.0 with a way of overriding the default positioning function. By overriding the function you could set the container to be fixed positioned and made all the necessary adjustments to the ac container. |
Hello @hakib Best Regards |
Hey @abourakba, The position_autocomplete settings is done via the directive provider. In you'r main app inject the provder
|
Hello @hakib
and then I added the piece of CSS :
.my-autocomplete .ac-container{
position : relative;
top: 100% !important;
left: 0 !important;
width: 100% !important;
} I tried to use the run on my main app but I get some error. Many thanks for your quick response. I will try more tomorrow :) Best Regards |
To override
|
JSbin with issuee:
http://jsbin.com/xirukapuho/1/edit?html,css,js,output
When the dropdown is on a fixed element, floating somewhere below the top of the page, the dropdown position is calculated incorrectly. I think this is due to the fact that the position is calculated relative to the document, but the absolute style is relative to the parent.
This could solved by finding the directive element's offset from the top of the page (and left) and subtracting from the position value.
The text was updated successfully, but these errors were encountered: