ウィンドウのサイズを変更するたびにangleディレクティブから要素の幅を更新するにはどうすればよいですか?サイズ変更後にngスタイルの幅を更新する
今すぐバインドは1回だけです。
DIRECTIVE
function calculateGameWidth() {
scope.responsiveGameWidth = Math.floor((window.innerWidth - 22)/Math.floor((window.innerWidth - 22)/232)) - 6;
return scope.responsiveGameWidth;
}
calculateGameWidth();
//On resize
window.onresize = function() {
calculateGameWidth();
}
HTML
<li ng-style="{width: responsiveGameWidth+'px'}"></li>
は事前にお願いします。
https://stackoverflow.com/questions/30561615/css-update-on-resize-withを機能することはできません-angularjsは重複していますか? – sweaver2112
すでにありません! :) –