Solved

Galleriffic Jquery

Posted on 2014-02-25
4
246 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
  • 3
4 Comments
 
LVL 52

Assisted Solution

by:Julian Hansen
Julian Hansen earned 500 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 52

Accepted Solution

by:
Julian Hansen earned 500 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 52

Expert Comment

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

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
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 …

910 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now