Hi, go to NGGallery’s Gallery settings tab where you will find a “Number of columns” field, set that to zero.
Also, you should remove the style="width:25%;" from the .ngg-gallery-thumbnail-box elements.
Thread Starter
nhall2
(@nhall2)
I removed the width style from the .ngg-gallery-thumbnail-box element, but it had no effect. I have the number of columns field set to 4 so that it doesn’t look as bad on a mobile device when viewed. If I set it to 0, it shows 6 images (like the desktop browser) and squeezes them so they are distorted. The site template is responsive, but the ngg gallery isn’t behaving in a responsive manner. I’m stumped.
Thread Starter
nhall2
(@nhall2)
If you drag your desktop browser handles to make the window smaller (like a mobile device) you’ll see what I mean. The images are just squeezed together and distorted. There must be a simple fix for this, but I don’t know what it is.
Your code looks like this (verify it in your browser’s inspector:
<div id="ngg-image-1" class="ngg-gallery-thumbnail-box" style="width:25%;">…
<div id="ngg-image-2" class="ngg-gallery-thumbnail-box" style="width:25%;">…
<div id="ngg-image-3" class="ngg-gallery-thumbnail-box" style="width:25%;">…
<div id="ngg-image-4" class="ngg-gallery-thumbnail-box" style="width:25%;">…
<br style="clear: both" />
If you look into nextgen-gallery/view/gallery.php you will see what creates the line breaks:
<?php if ( $gallery->columns > 0 && ++$i % $gallery->columns == 0 ) { ?>
<br style="clear: both" />
<?php } ?>
There is also a style="width:25%;" at every line. It is from this line:
<div id="ngg-image-<?php echo $image->pid ?>" class="ngg-gallery-thumbnail-box" <?php echo $image->style ?> >
This is probably set at Gallery / Options / Effects at the admin dashboard as a custom code. I hope you realize that 25% means 4 columns 🙂
Image squeezing is caused by this rule in your css:
.entry-content img, .comment-content img, .widget img {
max-width: 97.5%;
}