473,386 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to apply a script to a group of elements individually?

I'm using the jQuery Cycle plugin to create a 4x3 grid of slideshows. I've been using the document.ready script to run the slideshow, but that makes the plugin run once and apply to every element (divs that only show one image at a time). I'm using a randomnumber function to make each load of the slideshow use a different interval.

Expand|Select|Wrap|Line Numbers
  1.     <script type="text/javascript">
  2.         $(document).ready(function() {
  3.             var randomnumber=Math.floor(Math.random()*10)
  4.  
  5.             $('.slideshow').cycle({
  6.                 fx: 'curtainX,curtainY', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
  7.                 random: true, // true for random, false for sequence (not applicable to shuffle fx)
  8.             });
  9.         });
  10.     </script>
  11.  
I'm looking into the Cycle plugin now to try to find out how use the interval created by randomnumber, but the real issue is that I don't know how to alter the code so that it loads for each individual slideshow. If each one of them had their own speed, then the entire "wall" would look like it was constantly changing or updating.

Any help here is appreciated. I just don't know enough about Javascript to even know where to start. I'm picking this up by ripping apart other people's codes and trying to piece things together.

Each of my slideshows use a simple div.. img /.. /div style.
Expand|Select|Wrap|Line Numbers
  1. <div class="slideshow">
  2.     <img src="path/to/img.jpg" alt="" />
  3.     <img src="path/to/img.jpg" alt="" />
  4.     <img src="path/to/img.jpg" alt="" />
  5. </div>
  6.  
The Cycle plugin works just fine. I'm linking the jQuery library and the Cycle plugin to the page, but that has nothing to do with my question. (I just wanted to make sure that was clear.)

Finally, the bottom line:
How can I modify my current code to use the Cycle plugin for each instance of a slideshow to create a wall of movement?
Nov 1 '10 #1
1 1522
acoder
16,027 Expert Mod 8TB
The problem is that you're selecting all slideshows on this line: $('.slideshow').cycle({. To select each individual slideshow div, you can give each an ID, e.g. <div class="slideshow" id="ss1"> and then access as $('#ss1').cycle({ or you could give each another class to differentiate.
Nov 2 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Clay Beatty | last post by:
When you create database diagrams in Enterprise Manager, the details for constructing those diagrams is saved into the dtproperties table. This table includes an image field which contains most of...
13
by: Mikko Ohtamaa | last post by:
From XML specification: The representation of an empty element is either a start-tag immediately followed by an end-tag, or an empty-element tag. (This means that <foo></foo> is equal to...
2
by: Randy Starkey | last post by:
Hi, Can anyone point me in the right direction on this? Is there a way to expand and collapse all instances of this script on a single page? The script works well individually. I do the HTML...
2
by: luke.crouch | last post by:
My server-side php script is generating an xml response with the following structure: <thread class='Columns'> <Id class='Column dataDetail'>12345</Id> <Command class='Column...
1
by: Gi | last post by:
Hi, Can anyone tell me you can I transform this kind of XML: <Cont ID='faqs'> <Conts ID=''> <Elements> <Data></Data> <Pergunta></Pergunta> <Resposta></Resposta> </Elements>
1
by: karthikpv | last post by:
Hi, I am trying to group nodes in a huge xml file by one of the common fields. I have tried using "for-each-group" and "group-by" but am unable to get it working. Here, I have a list of Ports...
6
by: Jakub.Bednarczuk | last post by:
Hallo everybody I have the problem with getting attributes values and also attributes names. I am reading an xml file with DOM. Lets see an example: file I read <root> <Def></Def>...
2
by: sjoshi | last post by:
Is List.ConvertAll the only way to apply TrimStart to elements of a List<stringor is there a better way ? Currently I'm doing this... List<stringlst = new List<string>(); lst.AddRange(new...
1
by: boarderchic15 | last post by:
Hi- I have the following XML structure: <?xml version="1.0" encoding="UTF-8"?> <content> <type content_type="Listing"/> <faq_listing> <heading>Benefits</heading>...
7
by: Chris Riesbeck | last post by:
What's the right way to make sure checkboxes stick with their labels when the window is resized? Right now I'm trying <label><input ...text</labelwith white-space:nowrap on label, but this only...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.