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

popover array is missing when popover-placement is top-left bottom-left #25

Open
mindej opened this issue Jun 6, 2018 · 3 comments
Open

Comments

@mindej
Copy link

mindej commented Jun 6, 2018

To reproduce go to

https://morgul.github.io/ui-bootstrap4/

image

Version of Angular, UIBS, and Bootstrap
Angular: 1.5.0

UIBS: 3.0.3

Bootstrap: 4.0.0

@Morgul
Copy link
Owner

Morgul commented Jun 22, 2018

image

The arrow positioning code is horribly broken; and my few hacks to it have fixed the very slim use case I had, but it's really a mess.

I would love to get some help fixing it; I've spent a few hours and are no closer to understanding how that code originally functioned than I am now, let alone coming up with a fix. Alternatively, the project could be ported to using popper.js.

@DarkNami
Copy link

DarkNami commented Jul 5, 2019

Bootstrap 4 only provide 'top, bottom, left, right' 4 placements, you have to add 'top-left' by self.

This is 'left-top' for Bootstrap v4.3.1:

.bs-popover-auto[x-placement^="left-top"], .bs-popover-left-top {
	margin-right: .5rem;
}

.bs-popover-auto[x-placement^="left-top"] > .arrow::before, .bs-popover-left-top > .arrow::before {
	right: 0;
	border-width: .5rem 0 .5rem .5rem;
	border-left-color: rgba(0,0,0,.25);
}

.bs-popover-auto[x-placement^="left-top"] > .arrow::after, .bs-popover-left-top > .arrow::after {
	right: 1px;
	border-width: .5rem 0 .5rem .5rem;
	border-left-color: #fff;
}

.bs-popover-auto[x-placement^="left-top"] .arrow, .bs-popover-left-top .arrow {
	right: calc(-0.5rem);
	width: .5rem;
	height: 1rem;
	margin: .3rem 0;
}

圖片

@BabyBoat
Copy link

BabyBoat commented Jul 27, 2019

Thanks DarkNami,

Here is the fix for bottom-right:

` .bs-popover-auto[x-placement^="bottom-right"], .bs-popover-bottom-right {
margin-top: .5rem;
}

.bs-popover-auto[x-placement^="bottom-right"] > .arrow::before, .bs-popover-bottom-right > .arrow::before {
    top: 0;
    border-width: 0 .5rem .5rem .5rem;
    border-bottom-color: rgba(0,0,0,.25);
}

.bs-popover-auto[x-placement^="bottom-right"] > .arrow::after, .bs-popover-bottom-right > .arrow::after {
    top: 1px;
    border-width: 0 .5rem .5rem .5rem;
    border-bottom-color: #fff !important;
}

.bs-popover-auto[x-placement^="bottom-right"] .arrow, .bs-popover-bottom-right .arrow {
    top: calc((.5rem + 1px) * -1);
}`

Costed me more than an hour to understand those crazy stuffs and imitate DarkNami solution. Hope someone in the future can figure this out for themselves

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

No branches or pull requests

4 participants