Skip to content
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

Picker is mis-placed if injected into an element with relative or absolute positioning #125

Open
matchami opened this issue Oct 25, 2012 · 1 comment

Comments

@matchami
Copy link

If options.inject is used and the element has relative or absolute positioning, this is not taken into account when the picker is positioned, so it is placed at document relative coordinates within the target element.

Suggested fix at line 190 of Picker.js:

        if (this.options.inject && (this.options.inject.getStyle('position') == 'relative' || this.options.inject.getStyle('position') == 'absolute')) {
            var parentCoords = this.options.inject.getCoordinates();
            elementCoords.left -= parentCoords.left;
            elementCoords.right -= parentCoords.left;
            elementCoords.top -= parentCoords.top;
            elementCoords.bottom -= parentCoords.top;
        }
@loicfavory
Copy link

Got the same problem, but you should use the relative option of the getCoordinates() function.

var elementCoords = element.getCoordinates(this.options.inject);

And there is still a problem if your element has scroll.
I'm working on a new version of the position function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants