【Vagrant】Windows7で最新のVagrantを使用する
Windows7に最新のVagrant(2.1.5)をインストールし、vagrantを実行すると、PowerShellのバージョン3が必要だというエラーメッセージが出力されます。
解決法は、PowerShellバージョン2で動作するVagrantにダウングレードするか、PowerShellをアップデートするかなのですが、前者はできませんでした。
よって、PowerShellをアップデートします。
1.OSに対応する Windows Management Frameworkをダウンロードし、解凍
https://docs.microsoft.com/ja-jp/powershell/wmf/readme
https://www.microsoft.com/en-us/download/details.aspx?id=54616
2.PowerShellを管理者権限で実行する
3.PowerShellの実行ポリシーを変更
4.PowerShellで、1でダウンロードしたスクリプトを実行
5.PowerShellの実行ポリシーを元に戻す
【jQuery】animateで、拡大縮小する
jQueryのanimateは、数値で設定できるスタイルシートのプロパティでしかアニメーションできません。
なので、
>||
$("#img").animate({
transform: 'scale(2)'
});
||<
と書いても「scale(2)」は数値ではないので、拡大されません。
こういう時は、animateのstepを用いて、以下のように書きます。
$( "#img" ).animate({
margin: '2px'
},{
duration: 1500,
step: function( now, fx ){
if( fx.prop == "margin"){
$("#img").css({ transform: 'scale(' + now + ')' });
}
}
});
例えば倍率を、1から2に変化させたいのであれば、marginにあらかじめ1pxを設定し、それをanimateで2pxまで変化させます。そのmarginの変化していく値を、scaleに設定します。
marginを使えない場合は、paddingなど、見た目にあまり影響を及ぼさないプロパティを使います。