automatic slideshow / iwakami

gartenstuhl / 2009-08-07 13:22:45   

is there a way to trigger the iwakami slideshow automatically?
like: setTimeout(\"show_image($next)\", 10000); in dynamicJS().
But how will I get the $next var into the javascript?!

Vaska A / 2009-08-07 13:27:57   

Yeah, that's the right path. And then you would need to add a settimeout that would be self referential and keep you running through the loop.

You would probably need to add to as a $(document).ready use (look it up at Jquery.com) to get it rolling.

gartenstuhl / 2009-08-07 18:39:29   

thanks.

I came up with something like this now in dynamicJS()
I get the amount of pics with get_total() and increase the id starting 1 till total and start with 1 again.

But the fade looks kind of ugly. I want the previous pic to fadeout like fadeOut(3000) and the new one with 3000 fadeIn too. But it shows all pics at the time and fades them all out...

var total = ".get_total().";
    var counter= 2;
    
    function show_image(id)
    {    
        $('.pic').hide();
        $('#p' + id).fadeIn('slow');
        $('#num').html(id);
        return false;
    }
    
    function start_slide(){
        if(counter > total){
        counter = 1;
        }
    show_image(counter);
    counter++;
    }
    
    window.setInterval('start_slide()', 9000);

Vaska A / 2009-08-07 21:06:37   

It works? That's great! I'm sure folks will be interested in that one...

;)

beside / 2009-09-05 20:15:52   

Here is the solution that works:

  1. Don't change
  2. function dynamicJS()
  1. add:
  2. $s .= "<script type='text/javascript'>n";
  3. $s .= "var total = $total;n";
  4. $s .= "var counter= 2;n";
  5. $s .= "function start_slide(){n";
  6. $s .= "if(counter > total){n";
  7. $s .= "counter = 1;n";
  8. $s .= "}n";
  9. $s .= "show_image(counter);n";
  10. $s .= "counter++;n";
  11. $s .= "}n";
  12. $s .= "n";
  13. $s .= "window.setInterval('start_slide()', 5000);n";
  14. $s .= "</script>n"; 

after:

  1. // images
  2. $s .= "<div id='img-container'>n";
  1. in:
  2. function createExhibit()
paucc A / 2009-09-05 21:59:01   

That sounds interesting!

dudesek / 2009-09-24 13:41:28   

beside. I tried your code in a plugin I named "exhibit.slideshow_auto.php" but it just rendered a "n" and nothing happend:
http://dudesek.ch/index.php?/unfassbar/kolotoc/
could you say why?
no probs with original slideshow plugin..

dudesek / 2009-09-29 15:49:17   

sorry that was of course the wrong plugin I edited...

jaz / 2009-12-02 22:31:50   

dudesek, beside

I am having the same trouble as dudesek.

I put the (code) solution from beside into the iwakami plugin, exactly where instructed.

Nothing changed. An "n" appeared above the image and no fading occurs.

Any ideas as to what I could be doing incorrectly?!

Thanks!

mendel1 / 2010-01-08 14:57:45   

Hey!

I really like this idea. Did anyone manage to make this work? I've been trying out some stuff, but nothing seems to work.

I t would be really nice if someone has a clue or a working alternative.
Thanks!

puppiepoppy / 2010-01-08 18:00:11   

Hi gartenstuhl,

May I know your website url? Would love to see what you've done.

Mike

Spag / 2010-02-19 16:55:52   

To use what Beside posted, just add a back-slash "\" before the "n" at the end of every line...

farwest1 / 2010-02-25 17:05:52   

I just let out a silent shout of absolute joy when I got Beside's modification to work!

Opening page automatic slideshow is running! Beautiful!

lemathieu A / 2010-02-25 17:50:06   

Mike, please for last time, do not post your link everywhere…

.

Thank you.

rickykappa / 2010-02-25 17:50:55   

nice feature, and it works also with Slideshow/Thumbnail power combo, or at least with FF in my test page.
there is actually a little bit of mess if you play with prev/next arrows, probably a counter conflict.
but, next step, any idea on how to make a start/stop onclick?

farwest1 / 2010-02-25 18:00:44   

Sorry, lemathieu, who is Mike?

rickykappa / 2010-02-25 18:04:16   

search box with his nickname, you'll surely get a link
;-)

cooper / 2010-04-06 19:00:59   

i got besides edit to work with the automatic slideshow, thanks! but can't get any sort of fade working....anyone managed?

cooper / 2010-04-06 19:03:03   

and also can't figure out how to get rid of the counter now i dont need it....any tips?

would be much appreciated

ntlk / 2010-05-19 22:18:20   

To get rid of the counter:

  1. In the line that says:
  2. $s .= "<p id='nums'><span id='num'>1</span>/$total</p>";

add two slashes at the start of the line, like so:

  1. //$s .= "<p id='nums'><span id='num'>1</span>/$total</p>";

I tried to add fade to it, with no luck so far.

michellehuang / 2010-09-03 17:58:31   

Hi,
I'm having problems with inserting the initial code.

should

  1. var total = ".get_total().";
  2.     var counter= 2;

be inserted straight before

  1. function show_image(id)
  2. ?

Because it's giving me errors

my website is: www.michellehuang.com

I've been tweaking around with the code but I can't seem to find a defect.

Thanks in advance ;-)

michelle

michellehuang / 2010-09-03 17:59:04   

ps: I'm using under "Iwakami teste"

michellehuang / 2010-09-03 22:29:24   

this is how my script is atm

  1. <?php if defined'SITE' exit'No direct script access allowed'

/**
* Iwakami
*
* Exhibition format
*
* @version 1
* @author Vaska
*/

// defaults from the general libary - be sure these are installed
$exhibit['dyn_css'] = dynamicCSS();
$exhibit['dyn_js'] = dynamicJS();
$exhibit['exhibit'] = createExhibit();

function dynamicJS(){
var total = ".get_total().";
    var counter= 2;

    function show_image(id)
    {
        $('.pic').hide();
        $('#p' + id).fadeIn('slow');
        $('#num').html(id);
        return false;
    }

function start_slide(){
    if(counter > total)    {
        counter = 1;
    }
    show_image(counter);
    counter++;
}

window.setInterval('start_slide()', 5000);

    
function createExhibit()
{
    $OBJ =& get_instance();
    global $rs;
    
    $pages = $OBJ->db->fetchArray("SELECT *
        FROM ".PX."media, ".PX."objects_prefs
        WHERE media_ref_id = '$rs[id]'
        AND obj_ref_type = 'exhibit'
        AND obj_ref_type = media_obj_type
        ORDER BY media_order ASC, media_id ASC");

        
    // ** DON'T FORGET THE TEXT ** //
    $s = $rs['content'];

    if (!$pages) return $s;
    
    $i = 1; $a = '';
    
    $total = count($pages);
    
    // people will probably want to customize this up
    foreach ($pages as $go)
    {
     $title         = ($go['media_title'] == '') ? '' : $go['media_title'] . ' ';
     $caption     = ($go['media_caption'] == '') ? ' ' : $go['media_caption'];

        $x = getimagesize(BASEURL . GIMGS . '/' . $go['media_file']);
        
        $off = ($i == 1) ? "style='display: block;'" : "style='display: none;'";
        
        $next = ($i == $total) ? 1 : $i+1;
        
        $a .= "\n

{$title}
{$caption}

\n";
        
        $i++;
    }
    
    // images
    $s .= "\n";
    $s .= "\n";
    $s .= "var total = $total;\n";
    $s .= "var counter= 2;\n";
    $s .= "function start_slide(){\n";
    $s .= "if(counter > total){\n";
    $s .= "counter = 1;\n";
    $s .= "}\n";
    $s .= "show_image(counter);\n";
    $s .= "counter++;\n";
    $s .= "}\n";
    $s .= "\n";
    $s .= "window.setInterval('start_slide()', 5000);\n";
    $s .= "\n";
    //$s .= "

1/$total

";
    $s .= "\n";
    $s .= $a;
    $s .= "\n";
    $s .= "\n\n";
        
    return $s;
}

function dynamicCSS()
{
    return "#img-container { }
#pics { }
p#nums { }
.img-bot { margin-bottom: 12px; }";
}

?>

michellehuang / 2010-09-04 13:24:01   

nevermind just follow Beside's instructions and all will be ok... darn darn darn!!

martin_kohout / 2011-01-15 14:21:12   

hello!

i read the whole thread and followed the instructions by Beside but unfortunately, what i get is Slideshow the same as before.

I tried to set the total property to a number manually but that doesn't change it. The code looks identical to the one in the post but my main concern is that the code that appears in the page is missing the $total in the 3rd line of the example. Is that supposed to be?

The page where I'm testing it is here.

The modified slideshow is here: http://www.fernandogarciadory.com/ndxz-studio/site/plugin/exhibit.slideshow_autoslide.php

martin_kohout / 2011-01-15 14:21:59   

I'd be very thankful for any help!

Best,
MK

cristinatorres / 2011-02-04 06:28:35   

Hello, I have the iwakami plugin installed, it's working good, but the buttons NEXT | PREV are in two different lines, it seems that each one has a 400px margin-left. I've tried everything and I really don't know how to solve this. Can you help me please?

Check the gallery here: http://www.hrsolimar.es
thanks!

cristinatorres / 2011-02-04 06:29:42   

Hello, I have the iwakami plugin installed, it's working good, but the buttons NEXT | PREV are in two different lines, it seems that each one has a 400px margin-left. I've tried everything and I really don't know how to solve this. Can you help me please?

Check the gallery here:

http://www.hrsolimar.es/index.php?/castellano/galeria-de-imagenes/

This thread has been closed, thank you.