두 가지 기능이 있습니다. fTwo() 전에 fOne()을 실행해야합니다. jQuery로 두 함수를 순차적으로 실행하십시오.
function fOne() {
if ($('.container').width() < 300) {
$('.box').each(function(){
$(this).removeClass('largeSize').addClass('smallSize');
});
}
}
function fTwo() {
var el = $('.myElement');
$(el).each(function() {
var pcntH = el.height(),
scorH = el.parent().find('.box').outerHeight(true),
pcntT = scorH - pcntH - 5;
el.css({'position':'relative', 'top': pcntT + 'px'}).fadeIn('slow');
});
}
는 다음과 같이 수행 할 수 있는가 :
생각하지만 작동하지 않습니다
fOne().done(fTwo());
...
'폰에서 그것을 확인할 수 있습니다; fTwo();'? – George
@George is right –
어느 기능도 비동기 함수가 아니므로 순서대로 실행하십시오. – tymeJV