Solved

Galleriffic Jquery

Posted on 2014-02-25
4
256 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 57

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 57

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 57

Expert Comment

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

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

Suggested Solutions

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

738 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