Solved

Javascript TinySlideShow to be used multiple times on one webpage.

Posted on 2011-03-17
6
1,806 Views
Last Modified: 2012-05-11
I got TinySlideShow code from here: http://www.scriptiny.com/2008/12/javascript-slideshow/

I've put alot of work into integrating the TinySlideShow into this website: http://test.production.esa.edu.au/ndlrn/ndlrncatalog/final.html

the slideshow appears in the 'NUMBER -> counting beetles series'

unfortunately I discovered later that I need to use the TinySlideShow multiple times on the same webpage.

The way parameters are passed into a slideshow is as follows (appears at bottom of final.html page)
<script>
var slideshow=new TINY.slider.slide('slideshow',{
            id:'homepageSlider', // ID of the parent slideshow div
            auto:0,  // Seconds to auto-advance, defaults to disabled
            resume:false,  // Resume auto after interrupted, defaults to false
            vertical:false,  // Direction, defaults to false
            navid:'pagination', // Optional ID of direct navigation UL
            activeclass:'current',  // Class to set on the current LI
            position:0,    // Initial slide position, defaulting to index 0
            rewind:false,
            elastic:false
            });
</script>

I tried changing the parameter ID to class instead, which didn't work.

I'm trying to create the CSS/HTML/Javascript then place this into an XSL file which will pull alot of data dynamically and place it into the TinySlideShow.

If you think there's no solution to this please recommend any plugins thanks and much appreciated.
0
Comment
Question by:jeremyll
  • 3
  • 2
6 Comments
 
LVL 20

Expert Comment

by:Proculopsis
ID: 35155273

A pragmatic solution might be to drop each instance of the slideshow into its own iframe.
0
 
LVL 19

Accepted Solution

by:
Bardobrave earned 500 total points
ID: 35155284
I understand that you need to load different data into different instances of the slider.

If it's the case, the only thing you should need is to create different js object variables where you store the different instances of the class, and use them accordingly.

<script>
var slideshow1=new TINY.slider.slide('slideshow',{
            id:'homepageSlider1', // ID of the parent slideshow div
            auto:0,  // Seconds to auto-advance, defaults to disabled
            resume:false,  // Resume auto after interrupted, defaults to false
            vertical:false,  // Direction, defaults to false
            navid:'pagination', // Optional ID of direct navigation UL
            activeclass:'current',  // Class to set on the current LI
            position:0,    // Initial slide position, defaulting to index 0
            rewind:false,
            elastic:false
            });

var slideshow2=new TINY.slider.slide('slideshow',{
            id:'homepageSlider2', // ID of the parent slideshow div
            auto:0,  // Seconds to auto-advance, defaults to disabled
            resume:false,  // Resume auto after interrupted, defaults to false
            vertical:false,  // Direction, defaults to false
            navid:'pagination', // Optional ID of direct navigation UL
            activeclass:'current',  // Class to set on the current LI
            position:0,    // Initial slide position, defaulting to index 0
            rewind:false,
            elastic:false
            });
</script>

And so on... I don't know this plug-in, but I think you should be able to make it work this way.
0
 

Author Comment

by:jeremyll
ID: 35155458
Thanks Bardobrave,

I'm hoping for an alternative solution and looks like its the only solution available in which case ill need to find another slides jquery plugin. Please recommend any plugins. Thanks
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 19

Expert Comment

by:Bardobrave
ID: 35155547
I must be missing something here.

 Why do you seek an alternate solution to create different instances? Are you loading different slides each time or you need to load the same slide in different places?

You are going to pull data from database to slider through XSL (not very sure how) but don't see exactly what is the problem you have with the plugin. I fear we recommend you other plugins and you face the same problem later, maybe we should understand exactly what the problem is to try to find a solution.
0
 

Author Comment

by:jeremyll
ID: 35155728
Need to load about 40+ different slides on one webpage. Also, the number of slides is not fixed as a content editor will upload more slides later. So these slides need to be created dynamically.
0
 
LVL 19

Assisted Solution

by:Bardobrave
Bardobrave earned 500 total points
ID: 35155931
So wouldn't be better to store data about visible slides on database and load the number of sliders needed on executing time?

I mean. Your content editor will define wich, how many and what data include your sliders. This info will be somewhat included into your database.

Then, when you load a page when sliders are present, you can add a server routine that posts to client code instances of the slider, this way, when HTML response is sent to client machines, the js code to render 1,2, or any number of sliders will be present in the page (because your server code had inserted them there) and the plugin engine will do the rest.

If you are planning to use XSL transformations to build an instance of the slider don't would you be able to alter your transformation to detect the number of instances you need in each page and generate an instance for each one?

I suppose you'll read data from XML files, probably you can alter your XML structure from a single slider to a multiple one without too much problems.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now