Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Dan Rossiter

    (@danrossiter)

    Hi giuliosensi,

    The DG layout is already responsive to a degree. If you want to further customize output styling to match your layout you can always include custom styling in the “Custom CSS” textbox under Dashboard -> Settings -> Document Gallery.

    -Dan

    Jason

    (@jj9617)

    The Custom CSS textbox is very helpful, though I’ll add another tip:

    Since the inline element width styling (based on number of columns) normally takes priority and cannot be removed, you would need to add !important just before the semicolon in the custom CSS declaration.

    Example:

    @media screen and (max-width: 480px) {
    .document-gallery .document-icon {
      width: 99%!important;
    }
    }

    I just Googled it and it worked for me, though I have not tested it extensively. In effect, this makes a single column for mobile devices. If you wanted to create another breakpoint for tablets, simply create another rule for 768px and declare its width, perhaps 32% (which would be 3 columns). Unfortunately, documents are created in rows and cannot break out of the row when making responsive. Say you want 4 columns for desktop and 3 columns for tablets, and have provided custom CSS to make that happen. Tablet users see the first 3 documents in the top row, then below that the remaining (4th) document that “wrapped” around to the next line. The 5th document doesn’t follow after the 4th, but rather on the next line, since it has been placed in a new row based on number of columns in settings.

    A great enhancement to this plugin would be to improve responsiveness, so that documents are not stuck in their rows with a pre-determined number of columns.

    Thread Starter giuliosensi

    (@giuliosensi)

    Thanks for your support guys !!!

    Ciao !

    Giulio

    Thread Starter giuliosensi

    (@giuliosensi)

    Confirm

    @media screen and (max-width: 480px) {
    .document-gallery .document-icon {
      width: 99%!important;
    }
    }
    
    @media screen and (max-width: 768px) {
    .document-gallery .document-icon {
      width: 32%!important;
    }
    }

    works good for tablet and mobile !!

    Two thumbs up !!

    Thread Starter giuliosensi

    (@giuliosensi)

    Well to be more precise…

    @media screen and (max-width: 768px) {
    .document-gallery .document-icon {
      width: 32%!important;
    }
    }
    
    @media screen and (max-width: 480px) {
    .document-gallery .document-icon {
      width: 99%!important;
    }
    }

    Works better…

    Thats great! Thanks!

    I chose 6 columns of thumbnails for my layout, and 150×194 px thumbnails (a4 aspect ratio). With some additional styling, it looks fantastic in the divi theme I use. Sharing here for anyone who care:

    /* document gallery - some left margin in desktop mode*/
    @media screen and (min-width: 768px) {
      .document-gallery .document-icon-row {
        margin-left: 3%;
      }
    }
    
    /* document gallery - 3 columns in tablet portrait mode*/
    @media screen and (max-width: 768px) {
      .document-gallery .document-icon {
        width: 32%!important;
      }
    }
    
    /* document gallery - 2 columns in phone portrait mode*/
    @media screen and (max-width: 480px) {
      .document-gallery .document-icon {
        width: 49%!important;
      }
    }
    
    /* document gallery - larger thumbnail and shadow*/
    .document-gallery .document-icon img {
      width: 80%;
      max-width: 80%;
      box-shadow: 5px 5px 20px -5px rgba(0,0,0,0.5);
      margin-top:5px;
      margin-bottom: 5px;
    }
    
    /* document gallery - document text size and color */
    .document-gallery .document-icon a {
      font-size: 1em;
      line-height: 1.2em;
      color: black;
    }

    having to add !important is dumb.

    The plugin should just not have inline styling.

    use classes

    Plugin Author Dan Rossiter

    (@danrossiter)

    bheadrick,

    How exactly do you propose doing that with custom styles configured by users? The native DG styles are in a css file.

    -Dan

    Thanks for the quick response.

    It’s not that difficult

    native dg styles:

    .document-gallery .document-icon.4col{width:24%}
    .document-gallery .document-icon.3col{width:30%}
    etc…

    then set the appropriate class based on the selection in the shortcode rather than the inline style, so it can be overridden without the !important

    Plugin Author Dan Rossiter

    (@danrossiter)

    That requires limiting the number of columns, which we very intentionally did not do. Also, the !important is generally not a result of the small portion of dynamic code generated by DG, but rather the fact that the DG style file is loaded after the manual user code. That order is an artifact of how WP behaves in older versions. There is a way in newer versions (as in, earlier this year) that would allow us to fix that ordering, but it’s not at the top of our list given there is a reasonable workaround.

    -Dan

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘RESPONSIVE ???’ is closed to new replies.