Here is a code to auto change images(say ,after 5 seconds) in Galleria module.

function slideit() { $.galleria.next(); setTimeout("slideit()",5000); } slideit();

Put this javascript code in the Galleria modules galleria.tpl.php file and you can see the automatically changing big images.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

naim shaikh’s picture

If you are using jCarousel module with Galleria then here is a code to switch main image through jCarousel next and previous arrows:

Go to modules/jcarousel/jcarousel/lib files and search jquery.jcarousel.js file.
In this file find these 2 lines(line 177,178):

this.funcNext = function() { self.next(); };
this.funcPrev = function() { self.prev(); };

Replace these lines with the following code:

this.funcNext = function() { $.galleria.next(); };
this.funcPrev = function() { $.galleria.prev(); };

BeatnikDude’s picture

Thanks, I have used your javascript code works good. It would be nice to have options available via the settings; the option, the timer and perhaps the transition speed.

naim shaikh’s picture

Thanks BeatnikDude,
Really the team of Galleria should implement these features in the next version.So that Galleria will be the ultimate choice for picture Galleries.

jj37fr’s picture

BeatnikDude’s picture

@jj37fr the above is javascript, and should be placed in the javascript portion of the file.

davemybes’s picture

Status: Active » Needs review
FileSize
711 bytes
1.09 KB

I was just looking for this option, and ended up creating a patch for this. There are two patches, one for the admin settings page, and one for the template file. Of course, you can simply copy and paste the template file into your theme folder and add the javascript from the original post to it, but having a settings page might be simpler for some people.

I think a "pause on hover" option would be great too, in case people want to stop and look at an image. I don't know how to do this, so I'll leave it up to someone else for now.

synesis’s picture

In reply to incrn8 (I thought I clicked reply to your comment, but I obviously didn't)...

This code worked great, but we had to add a timer reset when some clicked the next or previous buttons. If we had a 5 second delay, and clicked next, we would only see the new image for 2 seconds before the image automatically changed.

In the galleria.tpl.php I took your code and turned it into this:

    <?php if (variable_get('galleria_autoslide', FALSE) == TRUE): ?>
      <script type="text/javascript">
        var resettimer;
        function galleria_settimer(){
         resettimer=setInterval("galleria_slideit()", <?php print variable_get('galleria_autoslide_delay', 5000); ?>);   
        }
        function galleria_slideit(doAction) {
          if(doAction == null || doAction !== false)
            $.galleria.next();
          else
            galleria_settimer();
        }
        galleria_slideit(false);
      </script>
      <?php endif; ?> 

Then in jquery.galleria.js we modified the next and previous functions to the following (Begining line 363):

next : function() {
        clearInterval(resettimer);
		var _next = $($$.nextSelector($('.galleria img[rel="'+$.galleria.current+'"]').parents('li'))).find('img').attr('rel');
		$.galleria.activate(_next);
        galleria_settimer();
	},
	prev : function() {
		clearInterval(resettimer);
        var _prev = $($$.previousSelector($('.galleria img[rel="'+$.galleria.current+'"]').parents('li'))).find('img').attr('rel');
		$.galleria.activate(_prev);
        galleria_settimer();
	}

We didn't make any changes to your admin code.

Hopefully this helps someone else.

BLOK Man’s picture

Hi

New member subscribing.

Thanks to both 'incrn8' & 'synesis' for the above. Have added the feature to our new site [in development]. Looks good.

One question....can the "transition rate" of the main image be slowed down. By "transition rate"...I mean the speed at which the main image fades/dissolves & is replaced, as opposed to the time delay between the images scrolling/changing.

At the moment...my images flash in & out a little too quickly.

Thnx

clau_bolson’s picture

This was just what I was looking for,
The only problem I found is that when the page was loaded the big image wasn't displayed, but I managed to fix it making the delay time bigger.

Thanks.

youlikeicecream’s picture

I noted on the main page for this module that the developer is looking for co-maintainers and that the development status for this project is idle. Galleria is a great slideshow module, works well and is nice and simple. The auto-transition should be a natural development for this project and should have a settings page.

Why not become a co-maintainer and contribute those patches?

Mike :)

Jumoke’s picture

In incrn8, amazing patch! Thank you :)

Yes, it would be nice to have the "pause on hover" option. Can anyone help with this please?

bcobin’s picture

Gosh - this is wonderful. Looks like the patch applied nicely to dev version and I did the mods in #7 - looking good!

Thanks so much for this - subscribing in the hopes of "pause on hover." Am I getting greedy? Yes!

Seriously, thank you... great work.

miro_dietiker’s picture

This is nice. Thank you.
As a Co-Maintainer, my primary focus is D7 (that's why we started as a co-maintainer and provided a port).

If you help us to port it to Drupal 7, i'll do the maintenance work like test, review, commit. However, D7 is the feature branch, so features in D7 first please.

drupalina’s picture

patches in comment #6 work perfectly! Awesome!!! Thanks incrn8!!!
The modifications in comment #7 by synesis still don't reset the timer! More work needed there.

I'd say this patch should definitely go into CVS -- very useful.

+1 for the "pause on hover" request by @Excalibur in comment #11 or, maybe some kind of play/pause buttons on the large foto.

My greatest worry at this stage is to be able to change the TRANSITION EFFECTS to something like FADE or SLOW-FADE. With this autoplay, it seems as if the images are "jumping" and after a while it hurts the eyes, and definitely distracts the end-user from reading the content below -- not good for the end-user. So, can we _please_ have an ability to change the transition effects?

Once again, Thanks!

kroimon’s picture

I'm currently working on a complete rewrite of the configuration screen (see #1185248: Better options page and per-page options).
With that, it should be possible to use all the options Galleria provides, including the autoplay and pauseOnInteraction settings and the transition and initialTransition settings.

drupalina’s picture

Thanks kroimon!
Just a note... there is also a small bug with the new patches here that needs to be taken into account: when the autoplay is on, and you scroll down the page to read the content, once the picture changes, the page jumps back to the top. This happens in Chrome, but not in Firefox.

dufferin’s picture

the patch works beautiful.
But really without a pause over function the feature is useless.
Put yourself in the end user skin, like it should be everytime a module is written... do you really think it is useful not to have the option to stop on an image to look at it as much as the end user wants?
It will be ported to 7, but so far it's not.
And in my case I have no way to upgrade to 7 since I use modules that are not yet ready for 7 if ever.

That's the main thing that can bother me with drupal in general. Lack of end user in mind. It's not a rant just an observation to see things moving forward the right direction.

Galleria has a huge potential.