Simple if/else rule to add 0 to number output
Hello, i wondered if anyone could help with this.
I'm currently editing a
Indexhibit website and trying to add a 0 (zero) to the number output of current image in a Slideshow exhibit.
Basically it displays e.g.
3/10 but i want it to display
03/10. This only applying to numbers less than 10.
The code is located in the
cycle.all.js file, which i think is around here somewhere:
-
function advance(els, opts, val) {
var p = els[0].parentNode, timeout = p.cycleTimeout;
if (timeout) {
clearTimeout(timeout);
p.cycleTimeout = 0;
}
opts.nextSlide = opts.currSlide + val;
if (opts.nextSlide < 0)
opts.nextSlide = els.length - 1;
else if (opts.nextSlide >= els.length)
opts.nextSlide = 0;
donum(opts.nextSlide + 1 + '|' + els.length);
go(els, opts, 1);
return false;
};
or here:
-
var $cont = $(this), $slides = $cont.children(), els = $slides.get();
donum('1|' + els.length);
if (els.length < 2) return; // don't bother
Now i'm no javascript wizard but i'm pretty sure an if/else rule will sort it. Please excuse my rudimentary code knowledge.
-
if (current img) < 10
donum('01|' + els.length);
else if (current img) > 9
donum('1|' + els.length);
If anyone can help i'd be vary grateful. Let me know if you need any other information.
Thanks very much.[/code]