# El encabezado se desplaza a la derecha al abrir la galería de imágenes

**URL:** <https://meta.discourse.org/t/header-shifts-to-the-right-when-you-open-image-gallery/112132>\
**Category:** UX\
**Created:** [20 Marzo, 2019 08:07 UTC](https://meta.discourse.org/t/header-shifts-to-the-right-when-you-open-image-gallery/112132 "2019-03-20T08:07:16Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)\
**Post date:** [20 Marzo, 2019 09:53 UTC](https://meta.discourse.org/t/header-shifts-to-the-right-when-you-open-image-gallery/112132/4 "2019-03-20T09:53:10Z")

</div>

Well, that’s a good question.

The answer is because Magnific-popup - the dependency the handles galleries in Discourse - actually does what I described above. It checks the width of the scrollbar in the current browser and then compensates with inline margins.

> <https://github.com/dimsemenov/Magnific-Popup/blob/master/dist/jquery.magnific-popup.js#L754-L756>

> <https://github.com/dimsemenov/Magnific-Popup/blob/master/dist/jquery.magnific-popup.js#L804-L814>

> <https://github.com/dimsemenov/Magnific-Popup/blob/master/dist/jquery.magnific-popup.js#L320-L325>

This works well for the content of the page, but the fact that the header in Discourse is positioned with CSS - absolute and then fixed when you scroll down - means that things don’t come out right for it. So, you get the issue you described.

So, the options are:

1- **manually compensate with CSS**  
this doesn’t work because of different scrollbar widths.

2- **maintain a fork of Magnific-popup that fixes this**  
this is out of the question.

3- **duplicate the scrollbar width calculation in Discourse**  
this is way too much code for a simple visual inconsistency.

4- **leave this as is because how involved a fix would be V.S the benefits of adding it.**

I still think #4 is the way to go here, at least for now.

---

_[View the full topic](https://meta.discourse.org/t/header-shifts-to-the-right-when-you-open-image-gallery/112132)._
