Need help with my javascript code?

24th of May 2012 0

Need help with my javascript code?

I’m trying to put a slideshow in my site for a school project. The buttons and the first picture shows up but the slides don’t move when I click the arrow. Can anyone tell me what the problem is?

Here is the code.




var totalSlides = 3;
var currentSlide = 1;
var contentSlides = “”;

$ (document).ready(function() {

var totalWidth = 100;
contentSlides = $ (“.slideshow-content”);
window.setInterval(‘autoScroll()’, 4000);

});

function autoScroll() {
//currentSlide–;
if (currentSlide < 2) { currentSlide++; updateContentHolder(); updateButtons(); } else if (currentSlide == 2) { currentSlide = 1; updateContentHolder(); updateButtons(); } } function showPreviousSlide() { currentSlide--; updateContentHolder(); updateButtons(); } function showNextSlide() { currentSlide++; updateContentHolder(); updateButtons(); } function updateContentHolder() { var scrollAmount = 0; contentSlides.each(function(i) { if (currentSlide - 1 > i) {
scrollAmount += this.clientWidth;
}
});
$ (“#slideshow-scroller”).animate({ scrollLeft: scrollAmount }, 1000);
}

function updateButtons() {
if (currentSlide < totalSlides) { $ ("#slideshow-next").show(); } else { $ ("#slideshow-next").hide(); } if (currentSlide > 1) {
$ (“#slideshow-previous”).show();
} else {
$ (“#slideshow-previous”).hide();
}
}


img01 Need help with my javascript code?
img02 Need help with my javascript code?
img03 Need help with my javascript code?


Best answer:

Answer by Ama Zeng
“Eh…I think it too complicated.
If you want to add a slideshow on your website, you may use a slideshow program such as Photo Flash Maker Freeware to help you out.
The program generates html code for embedding the slideshow into website.
You can free download the program from:
http://www.photo-flash-maker.com/download.html”

Know better? Leave your own answer in the comments!

Filed under § jquery ui — Tagged with , , ,

Share it!

Was it good for you to?

Sponsors

Support for the site!

No sponsors at the moment.



Your opinion matters. Add it below.


Tip: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Recent comments

Categories



Copyright jqueryui.info since 2010. All rights reserved. Design and the Absolute Theme by Tommie Hansen.