jackmoore / colorbox

A light-weight, customizable lightbox plugin for jQuery
http://www.jacklmoore.com/colorbox/
MIT License
4.75k stars 1.14k forks source link

Colorbox Resizing Parent's Width #903

Closed ecreamer closed 2 years ago

ecreamer commented 2 years ago

Hi,

We have used Colorbox many times and never seen this issue before. When the Colorbox opens, the width of the parent's content is being resized.

Without Colorbox Open: image

With Colorbox Open: image

Please take note of the right side of the screen. Either the width of the content is shrinking when the Colorbox is opened, or an excessive amount of right margin/padding is being added. Any suggestions on fixing this?

jackmoore commented 2 years ago

What options are you passing Colorbox? Have you tried using the maxWidth setting? This isn't enough info to diagnose your issue with any confidence.

ecreamer commented 2 years ago

The Colorbox initializes with the following:

if(windowwidth > 1000 && windowheight > 1000) $.colorbox({ href: href1, height:'70%', width:'90%' }); else $.colorbox({ href: href1, maxHeight:'400px', height:'90%', width:'90%' });

The problem is fixed if I supply a fixed width on my content, but that is not feasible for what we are doing. The Colorbox also stays inside of the window, it is only shrinking the content of the parent.

jackmoore commented 2 years ago

The Colorbox also stays inside of the window, it is only shrinking the content of the parent.

This shouldn't happen. I feel like something else is going on that would not be possible to diagnose without seeing a demo that could be inspected.

ecreamer commented 2 years ago

There was a weird style on the parent that was causing this issue.