...

View Full Version : jQuery slideshow: what it means with a '?' and ':' in the line



lauthiamkok
06-02-2009, 05:55 PM
Hi,
I got this code from elsewhere online, but i dont understand what this line mean,


var nextslide = currentslide.next().length ? currentslide.next() : $('#supersize :first');

what does it mean with a '?' and ':' in the line above?

Below is the full code,


function theslideshow() {

var currentslide = $('#supersize .activeslide');

if ( currentslide.length == 0 ) currentslide = $('#supersize :last');

var nextslide = currentslide.next().length ? currentslide.next() : $('#supersize :first');

nextslide.addClass('activeslide');
currentslide.removeClass('activeslide');

}

Many thanks,
Lau

adios
06-02-2009, 05:58 PM
Conditional (ternary) operator.

http://docstore.mik.ua/orelly/webprog/jscript/ch05_10.htm

lauthiamkok
06-02-2009, 07:00 PM
Conditional (ternary) operator.

http://docstore.mik.ua/orelly/webprog/jscript/ch05_10.htm

thanks.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum