我正在尝试将以下 JavaScript 转换为 CoffeeScript:
$(window).afterResize( function() {
var adjusted_window_height = $(window).height() - $('header').height() - $('footer').height();
var vid_width = $('#section').width();
var vid_height = adjusted_window_height - 20;
var vid_margin = (adjusted_window_height - vid_height)/2;
$('iframe.vimeo_player').css({
width: vid_width,
height: vid_height
});
if(vid_margin > 0){
$('iframe.vimeo_player').css('margin-top',vid_margin+'px');
}
//Adjusts for scroll-bar follies
if($('iframe.vimeo_player').width() < $('#section').width()){
$('iframe.vimeo_player').css({
width: $('#section').width(),
height: $(window).height() - $('header').height() - $('footer').height() - 20
});
}
}, true, 200 );
而我将函数作为函数调用的第一个参数传递的事实正在搞砸一切。谁能指出我正确的方向?