themyth92 / ngx-lightbox

Lightbox2 use with angular >= 5
MIT License
115 stars 66 forks source link

Close button Placement & custom css implementation #26

Open MsumanP opened 5 years ago

MsumanP commented 5 years ago

Is there any way to put the close button to top-right side corner & use custom css ?

themyth92 commented 5 years ago

Yes probably use custom css to override the .lb-close class.

MsumanP commented 5 years ago

I am not good in CSS. But I tried. Need help !!

faizalshap commented 4 years ago

You need to override .lb-dataContainer

.lb-dataContainer {
  position: absolute;
  top: 0px;
  right: 0;
}
Chewieez commented 4 years ago

One issue with overriding .lb-dataContainer using absolute positioning is then the element is stuck on the far right side of the screen. This works well in mobile in portrait mode, but is way off to the right side when viewing the lightbox on desktop, or even mobile in landscape view. You could use a percentage instead of a pixel amount but we don't know the width of the image, so it's still hard to consistently line up the element.

I think a config option to move the x button or the entire data container with caption and x button to the top would be a better solution.

fromage9747 commented 4 years ago

@faizalshap Thank you for providing the class that needs to be modified.

I copied and pasted your code snippet and received the below:

image

At least with the right class, modifications can be made. it would be great though if this could be a configurable option. The image text I would like to keep at the bottom but the close button I would like at the top right.

h5aaimtron commented 2 years ago

.lb-dataContainer { position: absolute; top:-50px; left: 50%; transform: translateX(-50%); }

This moves it to the top and centers it horizontally. Unfortunately, the lib has issues when resizing into mobile mode. Also has some issues with images overflowing in mobile. Really close though.