Nistor Alexandru
Nistor Alexandru

Reputation: 5393

jQuery cross fade slideshow bug

I have created a cross-fade slideshow which I have been trying to create for some time now being a beginner it took more then I expected and while I was celebrating that it was finally done I realized the slider had a bug here is the code:

slideshow code

If I click the button for NEXT or PREV the SlideShow starts taking speed in the time it's changing the images every time I click on them. Can anyone take a look at my code and tell me what I am doing wrong?

EDIT:I have added images. The problem with the code is that each time you click on next or prev the images start sliding faster and faster by default it should change an image every 4 seconds but after you click a few times on next or prev the speed in which the images change increases.

Upvotes: 0

Views: 222

Answers (1)

Pethical
Pethical

Reputation: 1482

http://jsfiddle.net/qve6z/ Here is a working code! I was:

  1. Moved your next and prev functions into $(function(){...}); body
  2. Added ; to end of the statements where missing
  3. Changed the order of your functions, declare first, call it second
  4. Changed setIntervals from setInterval("functionname()",1000) to setInterval(functionname,1000)
  5. Moved the first setInterval after function declarations.

I was changed your images to text (1,2,3,4), it was only for testing.

Upvotes: 1

Related Questions