Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Galleriffic Jquery

Posted on 2014-02-25
4
Medium Priority
?
258 Views
Last Modified: 2014-02-26
I am using a Galleriffic query gallery to display images . The problem is that I need to order the display of the images, so that they load vertically first then horizontally - the total size is 2 down x10 across. By default it loads horizontally first. Does anyone know how to do this. Many Thanks.
0
Comment
Question by:fred2k3
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 59

Assisted Solution

by:Julian Hansen
Julian Hansen earned 2000 total points
ID: 39888053
I expect you will need to change the order of your images. The plugin is laying out the images in standard HTML layout which is left to right before wrapping to the next line.

If you want it to go vertiaclly you will probably have to order your images so that each Nth image is the next successive one where N is the number of images that will fit horizontally in your container. So if 3 images can fit horizontally

Image 1
Image 4
Image 7
Image 2
Image 5
Image 8
Image 3
Image 6
Image 9
Image 10
0
 
LVL 59

Accepted Solution

by:
Julian Hansen earned 2000 total points
ID: 39888073
If your images are loaded dynamically then you can probably re-order them with a JQuery piece of code like this
// NUMBER OF IMAGES TO SHOW HORRIZONTALLY
var containersize = 3;
$(function() {

  // DETACH IMAGES INTO ARRAY OF ELEMENTS      
  var imgs = $('#gallerific img').detach();

  // DECLARE ARRAY FOR OUR SORTED IMAGES
  var n = Array();

  // INDEX FOR NEW ARRAY
  var c = 0;

  // LOOP THROUGH COLUMNS
  for(i = 0; i< containersize;i++) {
    
    // FOREACH COLUMN ADD THE nTH ITEM TO THE NEW ARRAY
    for(j = i; j < imgs.length; j+= containersize) {
      n[c++] = imgs[j];
    }
  }

  // APPEND IMAGES BACK TO CONTAINER
  $('#gallerific').append(n);

  // INITIALISE GALLERIFIC HERE
});

Open in new window

0
 

Author Closing Comment

by:fred2k3
ID: 39888404
Thanks, very much appreciated.
0
 
LVL 59

Expert Comment

by:Julian Hansen
ID: 39888446
You are welcome - thanks for the points.
0

Featured Post

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show, step by step, how to integrate R code into a R Sweave document
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

660 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question