Monday, 15 June 2015

javascript - Can an if statement be placed in another if else statment? -



javascript - Can an if statement be placed in another if else statment? -

i sense should able find google search, have not, i'll inquire here.

i maintain getting error on sec if statement, wondering if not allowed place if statement within pre-existing if/else statement.

thanks looking.

function flipimages(){ currentimage = fliparray[i]; if (i == 6) { clearinterval(interval) } else { // add together opacity animation flip less jarring // set @ 100ms fade in $(currentimage).animate({ opacity: 1 }, 100, function() { console.log(fliparray[i]); } // animate in kid divs of currentimage (which text on // "final" div) if ( $(currentimage).children().hasclass('final'){ $(currentimage).children().animate({ opacity: 1, left: '+=50' }, 500, function(){ console.log( $(currentimage).children() ); }); }); ); i++; }; }

u've missed ) after if ($(currentimage).children().hasclass('final') , couple of semicolons makesit invalid js.

function flipimages() { currentimage = fliparray[i]; if (i == 6) { clearinterval(interval); } else { // add together opacity animation flip less jarring // set @ 100ms fade in $(currentimage).animate({ opacity: 1 }, 100, function () { console.log(fliparray[i]); }); // animate in kid divs of currentimage (which text on // "final" div) if ($(currentimage).children().hasclass('final')) { $(currentimage).children().animate({ opacity: 1, left: '+=50' }, 500, function () { console.log($(currentimage).children()); }); } i++; } }

check here

javascript if-statement

No comments:

Post a Comment