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
Minimum size #159
Comments
ColorBox does need this option, and it's on my todo list. In the .cboxPhoto {min-height:700px;} On Thu, Feb 16, 2012 at 9:06 AM, Jurriaan Pruis
Jack Moore |
I used the fix mentioned in http://groups.google.com/group/colorbox/browse_thread/thread/5f892ed688b2af5 |
I'm currently trying to achieve the same thing: have a minimum height and width in situations where the image I'm displaying is very small. Unfortunately the google groups url doesn't seem to exist and the .cboxPhoto {min-height:700px;} doesn't work for me either. Are there any other suggestions on how I can do this? |
Anyone found a solution to this yet? jackmoore - any chance it might appear in next version? .cboxPhoto {min-height:700px;} doesn't do it. |
Sorry to dig up an old issue issue but any chance you will be adding this functionality? |
The following patch I'm pasting is what that google groups thread contained for this issue (kudos to the original patch author who I do not recall his name). I've been using it for years and slightly adapted it for 1.5.x and 1.6.x compatibility (mainly settings.get()). jackmoore, if you think this patch is not sloppy or dirty or anything, let us know if you would accept it as a Pull Request so I (or someone else) can prepare it and send it over to you. --- jquery.colorbox.js.orig 2015-05-07 13:43:27.328642831 +0300
+++ jquery.colorbox.js 2015-05-07 13:45:52.392729499 +0300
@@ -22,10 +22,12 @@
initialWidth: "600",
innerWidth: false,
maxWidth: false,
+ minWidth: false,
height: false,
initialHeight: "450",
innerHeight: false,
maxHeight: false,
+ minHeight: false,
scalePhotos: true,
scrolling: true,
opacity: 0.9,
@@ -788,11 +790,17 @@
function getWidth() {
settings.w = settings.w || $loaded.width();
+ if (settings.get('minWidth') && settings.w < settings.get('minWidth')) {
+ settings.w = setSize(settings.get('minWidth'), 'x');
+ }
settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
return settings.w;
}
function getHeight() {
settings.h = settings.h || $loaded.height();
+ if (settings.get('minHeight') && settings.h < settings.get('minHeight')) {
+ settings.h = setSize(settings.get('minHeight'), 'y');
+ }
settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
return settings.h;
}
@@ -1007,8 +1015,8 @@
}
}
- if (settings.h) {
- photo.style.marginTop = Math.max(settings.mh - photo.height, 0) / 2 + 'px';
+ if (settings.h || settings.get('minHeight')) {
+ photo.style.marginTop = Math.max((settings.h || settings.get('minHeight')) - photo.height, 0) / 2 + 'px';
}
if ($related[1] && (settings.get('loop') || $related[index + 1])) { |
Another vote for this to be added please! |
+1 |
The additions provided by Thanosk work for me as well. Please add them to the script. |
+1 |
+1 |
1 similar comment
+1 |
Add solution offered by thanosk
Add solution offered by thanosk
+1 |
I am using jQuery colorbox Version 1.6.4. |
it works for me ... Thanks |
When opening small pictures colorbox looks really weird (overlapping icons etc.)
Is it possible to add a minimum size config option?
For sample code see (replace img with photo): http://groups.google.com/group/colorbox/browse_thread/thread/5f892ed688b2af5
The text was updated successfully, but these errors were encountered: