Slideshow options

Bishop / 2008-10-07 22:51:42   

Hello,

Someone know how write & change the dynamic js part from the "slideshow" plugin to have the possibility to change picts with a simple 'click' on it [AND] on the prev / next labels.

Script for Prev / Next labels:

function dynamicJS()
{
global $timeout;
return "$(document).ready(function(){
$('#s1').cycle({
fx:'fade',
speed:'300',
timeout: 0,
next:'#next', prev:'#prev'});
});";

}

Script for simple click on picts:

function dynamicJS()
{
global $timeout;
return "$(document).ready(function(){
$('#s1').cycle({
fx:'fade',
speed:'1000',
timeout: 0,
next:'#s1'});
});";

}

And now, I would like to have a solution for the twice possibility!
Dank U

LeslieOA / 2008-10-08 02:45:10   

Sorry, it's late (3am) so I may just be being a little glib, but did you want to know where you would add your new JavaScript for the slideshow plugin?

If so, navigate to: -

  1. ndxz-studio/site/plugin/exhibit.slideshow.php

..and begin editing here.

Or, a safer option is to download this tweak I knocked up, drop it into your plugin folder (as above) and select Slideshow Tweak from your exhibition formats. Here's the full code, similar to yours above: -

  1. <?php if defined'SITE' exit'No direct script access allowed'
  2. /**
  3. * Slideshow Tweak
  4. *
  5. * Exhibition format
  6. * 
  7. * @version 1.0.0.0.0.0.0.0.0.0.1 (Because Simon ate a banana for lunch)
  8. * @author Simon Lagneaux¬†
  9. * @author Vaska
  10. * @tweaked Leslie Owusu-Appiah
  11. */
  12. // defaults from the general libary - be sure these are installed
  13. $exhibit'dyn_css'  dynamicCSS
  14. $exhibit'lib_js'  array'jquery.cycle.all.js'
  15. $exhibit'dyn_js'  dynamicJS
  16. $exhibit'exhibit'  createExhibit
  17. function dynamicJS
  18. ¬† ¬† global $timeout
  19. ¬† ¬† return "$(document).ready(function(){¬†
  20. ¬† ¬† $('#s1').cycle({
  21. ¬† ¬† fx:'fade',¬†
  22. ¬† ¬† speed:'2000',¬†
  23. ¬† ¬† timeout: 0,¬†
  24. ¬† ¬† next:'#next, #s1', prev:'#prev'});
  25. ¬† ¬† });"
  26. function createExhibit
  27. ¬† ¬† $OBJ  get_instance
  28. ¬† ¬† global $rs
  29. ¬† ¬†¬†
  30. ¬† ¬† $pages  $OBJ->db->fetchArray"SELECT *¬†
  31. ¬† ¬† ¬† ¬† FROM "PX"media, "PXobjects_prefs¬†
  32. ¬† ¬† ¬† ¬† WHERE media_ref_id = '$rsid'¬†
  33. ¬† ¬† ¬† ¬† AND obj_ref_type = 'exhibit'¬†
  34. ¬† ¬† ¬† ¬† AND obj_ref_type = media_obj_type¬†
  35. ¬† ¬† ¬† ¬† ORDER BY media_order ASC, media_id ASC
  36. ¬† ¬† ¬† ¬†¬†
  37. ¬† ¬† // ** DON'T FORGET THE TEXT ** //
  38. ¬† ¬† $s  $rs'content'
  39. ¬† ¬† if $pages return $s
  40. ¬† ¬†¬†
  41. ¬† ¬† ¬† ¬† $i  1 $a  ''
  42. ¬† ¬†¬†
  43. ¬† ¬† // people will probably want to customize this up
  44. ¬† ¬† foreach $pages as $go
  45. ¬† ¬† 
  46. ¬† ¬† ¬† ¬† $title ¬† ¬† ¬† $go'media_title' == ''  ''  $go'media_title'  ' '
  47. ¬† ¬† ¬† ¬† $caption ¬† ¬† $go'media_caption' == ''  ' '  $go'media_caption'
  48. ¬† ¬† ¬† ¬† //$x = getimagesize(BASEURL . GIMGS . '/' . $go['media_file']);
  49. ¬† ¬† ¬† ¬†¬†
  50. ¬† ¬† ¬† ¬† $a .= "n<div><img src='"  BASEURL  GIMGS  /$gomedia_file' class='img-bot' /><p>{$title{$caption</p></div>n
  51. ¬† ¬† ¬† ¬†¬†
  52. ¬† ¬† ¬† ¬† $i++
  53. ¬† ¬† 
  54. ¬† ¬†¬†
  55. ¬† ¬† // images
  56. ¬† ¬† $s .= "<div id='img-container'>n"
  57. ¬† ¬† $s .= "<p class='nav'><a id='prev' href='#'>Prev</a> | <a id='next' href='#'>Next</a>¬†
  58. ¬† ¬† ¬† ¬† ¬† ¬†<span id='num'></span></p>"
  59. ¬† ¬† $s .= "<div id='s1' class='pics'>n"
  60. ¬† ¬† $s .= $a
  61. ¬† ¬† $s .= "</div>n"
  62. ¬† ¬† $s .= "</div>nn"
  63. ¬† ¬† ¬† ¬†¬†
  64. ¬† ¬† return $s
  65. function dynamicCSS
  66. ¬† ¬† return "#num {padding-left: 6px;}
  67. ¬† ¬† .img-bot {margin-bottom: 6px; display: block; }
  68. ¬† ¬† #s1 { cursor: pointer;}"
  69. ?>

Live demo here

Nap time.
Peace!

This thread has been closed, thank you.