NextGen Gallery for WordPress – Random order Jquery slideshow

I’ve used NextGen gallery for WordPress quite a bit and it’s a nice plugin. BUT… I’ve always wanted to be able to do ‘easy embed’ multiple jquery slideshows that show images in a RANDOM order. (This IS possible using the Flash slideshow component but I don’t always want/need to use Flash for this).
The non-Flash (jQuery) slideshow component is currently quite basic, and after much hunting around it was looking like this simple requirement would be difficult to implement.

I have, however, found a simple hack for this. It does involve editing one of the plugin JS files though, which isn’t ideal (e.g. future plugin upgrades may well overwrite this change). But this instruction might help someone out – and might persuade someone more technical to extend the core plugin in some way.

Firstly, set up your working slideshow (I use the [ slideshow id=x width=a height=b ] shortcode to embed it in a page or post).
Next, to make this slideshow random edit the nextgen-gallery/js/ngg.slideshow.min.js file (from dashboard plugins>editor and find this JS file)
Find this snippet “cycle({fx:s.fx,containerResize:1,fit:1,” and immediately after this add
“startingSlide:Math.floor(Math.random()*x),”
where x is the number of slides in your gallery

NOTES/CAVEATS:
1) this will affect ALL slideshows in your site i.e. will make them all random
2) it’s not truly random, it follows the usual slide order, just randomises the *starting slide* (then wraps around at the end).
3) if you have multiple slideshows of multiple galleries in your site the value of x might become a problem as it’s a hardcoded global variable. Best option here would be to keep x the same as the number of slides in the smallest gallery.
4) in the same JS file i also changed “jQuery(obj+’ img:first’).fadeIn(1000,” to “jQuery(obj+’ img:first’).fadeIn(0,” to stop the slide 1 in the gallery showing up on page load. This *might* cause an issue on slow connections?

If anyone can improve this please do!
I would LOVE it if i could simply do something like [ slideshow id=x random=true ]

One response to “NextGen Gallery for WordPress – Random order Jquery slideshow”

  1. chrisd says:

    hmmm… not sure this actually works any more – can’t figure out what’s changed!

    use this instead? http://wordpress.org/extend/plugins/jj-nextgen-jquery-cycle/

Leave a reply

  •  

    Latest news

    A few new launches

    This is long overdue, and I still need to update the portfolio, but recent site launches for tallhatDesign ...continued


    New year, New office

    Happy New Year for 2014! The new year is a fresh start with a change of office. tallhatDesign ...continued


    Beware of 123-reg and their auto-renewal tactics

    Many years ago I registered 3 domains for a client with 123-reg.co.uk. About 18 months ago the client ...continued


     

    Our customers say...

    “I have absolutely no hesitation in recommending tallhatDesign. Chris [Dawson, Creative Director] has a brilliant combination of artistic design and professional application. His attention to detail and thorough understanding of our business enabled us to have complete faith in his ...continued


    “A shiver of excitement goes round the office every time an email arrives from tallhatDesign with a new design attached. We just know it’ll make us smile, fitting the brief perfectly and then going that little bit further. There’s always ...continued


    • Read more of our feedback...

 
 
Highslide for Wordpress Plugin