Solved

Galleriffic Jquery

Posted on 2014-02-25
4
242 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 51

Assisted Solution

by:Julian Hansen
Julian Hansen earned 500 total points
Comment Utility
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 51

Accepted Solution

by:
Julian Hansen earned 500 total points
Comment Utility
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
Comment Utility
Thanks, very much appreciated.
0
 
LVL 51

Expert Comment

by:Julian Hansen
Comment Utility
You are welcome - thanks for the points.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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 seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

763 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

9 Experts available now in Live!

Get 1:1 Help Now