Повторные вызовы функции self invoke, но функциональный код имеет проблему с повторением функции.Вызов функции self invoke
Javascript
//version 2
! function anf1(){
if(w0 = '0') { //always true will be executed
$('.fish1').stop().animate({'margin-left': w50, 'margin-top': '30px' }, 25000); //move object to the center of screen
console.log('start');
}
if(w50 = w50) { //always true will be executed after 1st if condition
$('.fish1').stop().animate({'margin-left': w70, 'margin-top': '-30px'}, 9000); //move object to 70% of browser width
console.log('middle')
}
if(w70 = w70) { //always true will be executed after the 2nd if condition
$('.fish1').stop().animate({'margin-left': ww, 'margin-top': '-45px'}, 35000, function(){
anf1(); // call self invoked function anf1
}); //move object to 100% of browser width
console.log('finish')
}
}();
HTML
JSfiddle ссылка https://jsfiddle.net/qytkg5h2/2/
= не == ... –