Changing Images In A Div

On the following link:
http://www.schuremediagroup.com/portfolio%20-%20Copy.html

I have a slider with 8 slides.  On each slide I have 6 images.  When the slide changes I want to change the image in each div.  How can I do this?  I attached the file that has the page.
portfolio---Copy.html
supersized.3.2.7.js
DS928Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kyle HamiltonData ScientistCommented:
with the current API, you could do something like this:

theme.afterAnimation(changeImages());

function changeImages(){
  // the code that changes images goes here

}

Open in new window

But this does not give you control over what images go with what slide. All it does is allow you to  execute some function every time a slide changes.

So, you can get the number of the current slide with:

vars.current_slide

Open in new window


putting it together, you might have some thing that looks like this:

theme.afterAnimation(changeImages());

function changeImages(){
   var currSlide = vars.current_slide;
   shuffleImages(currSlide);
  
}
function shuffleImages(idx){
   // code that shuffles images based on slide number
   // here you can decide which images will be hidden/shown (based on slide number)
}

Open in new window


let us know if you need more help
0
Kyle HamiltonData ScientistCommented:
or, to simplify, you could just do:

theme.afterAnimation(shuffleImages(vars.current_slide));

function shuffleImages(idx){
   // code that shuffles images based on slide number
   // here you can decide which images will be hidden/shown (based on slide number)
}

Open in new window

0
Kyle HamiltonData ScientistCommented:
then for the images shuffling, you might have a two dimentional array of images:

var allImages = [
  [slide1-img1.png, slide1-img2.png, slide1-img3.png],
  [slide2-img1.png, slide2-img2.png, slide2-img3.png],
  [slide3-img1.png, slide3-img2.png, slide3-img3.png]
  //etc..
]

Open in new window


you then populate the DOM with the correct images:

function shuffleImages(idx){
   // insert images into DOM from allImages[idx]
   var HTMLfrag = "", imgList = allImages[idx];
   for(var i = 0, l = imgList.length; i < l; i++){
      HTMLfrag += "<div><img src='imgList[i]'/></div>";
   }
  $("#base").html(HTMLfrag);
}

Open in new window

0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

DS928Author Commented:
Looks like a good start, but exactly what code would go into here?

theme.afterAnimation(shuffleImages(vars.current_slide));

function shuffleImages(idx){
   // code that shuffles images based on slide number <--------What Code?
  <div id='1'>
   		<div>
   		  <img src="portfolio/adele.jpg" alt="Adele" width="200" height="136" class="lefty">
   		</div>
   </div>
<div id='2'>
   		<div>
   		  <img src="portfolio/adam.jpg" alt="Adam" width="200" height="136" class="lefty">
   		</div>
   </div>
}

Open in new window

0
DS928Author Commented:
I think we crossed while typing.  I will try this.
0
DS928Author Commented:
Having a problem here.
var allImages = [
  		[slide1-portfolio/bey.jpg, slide1-portfolio/adele.jpg, slide1-portfolio/adrian.jpg],
  		[slide2-img1.png, slide2-img2.png, slide2-img3.png],
  		[slide3-img1.png, slide3-img2.png, slide3-img3.png]
  		//etc..
		]

Open in new window

Not sure how to access or point to folder where the files are....
0
Kyle HamiltonData ScientistCommented:
oh, sorry, you need quotes around the image paths:

["slide1-portfolio/bey.jpg", "slide1-portfolio/adele.jpg", "slide1-portfolio/adrian.jpg"]

the entry in the array becomes the image src. so, if you wanted something like this:

<img src="slide1-portfolio/adele.jpg"/>

Open in new window


then your array would look like this:

["slide1-portfolio/bey.jpg", "slide1-portfolio/adele.jpg", "slide1-portfolio/adrian.jpg"]

Open in new window


if you want to provide an absolute path, like this:

<img src="http://www.mysite.com/images/slide1-portfolio/adele.jpg"/>

Open in new window


then the array would be:

["http://www.mysite.com/images/slide1-portfolio/bey.jpg", "http://www.mysite.com/images/slide1-portfolio/adele.jpg", "http://www.mysite.com/images/slide1-portfolio/adrian.jpg"]

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DS928Author Commented:
Good Job!
Thank you!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.