Question

I am using jQuery plugin called GalleryView, in its Beta3 version (http://spaceforaname.com/galleryview). The Beta4 version is planned to have built-in controls for play/pause animation. My question is:

How to emulate 'play' and 'pause' controls from outside the script without the need to modify GalleryView code. Is there any plugin for that? Or maybe undocumented action?

During the initialization it is possible to decide whether you want the autoplay feature on or off.

If there is no action/plugin available, how did you solve that? Can you share GalleryView modification you applied?

Regards, T.

Was it helpful?

Solution

I solved this by modifying original GalleryView script by adding the following things:

  • paused variable within script, storing the status of pause/play (true if paused, false if playing),
  • added the following callback definition:

    /*
    **  playPause()
    **      Resume slideshow if paused, pause if slideshow playing.
     */
    function playPause() {
        if(!paused) {
            // Pause slideshow in 500ms. This allows for brief swipes of the mouse over the gallery without unnecessarily pausing it
            $(document).oneTime(0,"animation_pause",function(){
                $(document).stopTime("transition");
                paused = true;
            });
            $('.gv-nav-play-pause').removeClass('gv-nav-pause').addClass('gv-nav-play');
        } else {
            $(document).stopTime("animation_pause");
            if(opts.transition_interval > 0) {
                $(document).everyTime(opts.transition_interval,"transition",function(){
                    showNextItem();
                });
                paused = false;
            }
            $('.gv-nav-play-pause').removeClass('gv-nav-play').addClass('gv-nav-pause');
        }
    };
    
  • added a button for play/pause, styled it and attached playPause callback to it on click and some touch events (to allow touch-enabled devices).

It worked like a charm, without glitches, but the code may not be perfect - I had to use original GalleryView code, which itself is not perfect.

OTHER TIPS

As of now I haven't found any way to turn autoplay off (I would like that option as well). It is my understanding that the next version will have player controls. As of this post it is still unstable but promising. Here's a link to the version 3 Beta4 demo page by the GalleryView author:

http://spaceforaname.com/galleryview-3.0/testpage.html

I'm using the current version and needed the autoplay turned off on one slider. I solved it by putting in a 10 minute delay between cycles. This gave the 9 minute video in one of the slides time to play. A longer delay (30 minutes) would effectively turn off autoplay.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top