-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Why do i have different Width for Wrapper and ContentBox ? #881
Comments
It's because of the chrome around Colorbox, the frame that exists between the content and the background. The innerWidth property specifies how width the content inside Colorbox should be. You'd typically use innerWidth (width of the content) or width (width of the content + the Colorbox frame/border), but not both at once. Some applications benefit from specifying the content size, while some need to account for the overall size. You are welcome to change the CSS so that there is no frame around your content, which would mean the content width (innerWidth) would match the outside width (width or maxWidth). |
Thanks for your answer, but that doesnt solve my issue. Even if i replace innerWidth with width setting i get same exact result: wrapper - 510px, cboxContent 462px. (i set width to "90%", because i want responsivness to colorbox modal window) And i also unable to change css propersties since all width is applied inline with higher priority to my css rules. |
You don't need to create a new ticket for me to see your feedback. Github tickets is not a support group, it's for things that need to be fixed in the code. I don't plan on changing the code based around this, so I closed the ticket. No offense intended.
You asked why are these sizes are different and I tried to answer that. Let me see if I understand your issue better now. Are you saying that you want Colorbox to take up 90% of the screen width, but that the content should have a min-width of 510px? This is some sophisticated than what Colorbox can handle through it's parameters, it just covers the basics and doesn't try to recreate the full range of what you can accomplish with CSS. My advice would be to wrap your content with an element that lays out how big you want that content to be on screen. Something like this:
Colorbox adds your content to the DOM and measures it before displaying, so it will respect layout rules & styles you apply to your content. I used vw instead of percent-based width. Percent is based on the parent, which in this case would be the staging area that Colorbox measures your content in, instead of the size of the screen, which isn't helpful in this case. I hope that's somewhat helpful. |
Thanks again for answering. Sorry for being that much disturbing. You understand my issue correctly with only one wrong (doesn't matter at all) little fix - i want max-width to be 510px. Actually, i am not looking for support, i just want to understand how colorbox works more deeply, but that actually also not a thing to create tickets.... sorry... Let's suppose this ticket solved for now. |
I am using colorbox for a simple fast purchase window in opencart extension. I am calling colorbox with this args(i tried many different variations actually):
As a result main cbox div(wrapper) has 510px width but cboxContent 462 , a 48px smaller. I googled for couple hours but have not found an answer how to make width equal.
The text was updated successfully, but these errors were encountered: