2017-09-08 5 views
0

私の目的は、window.open()メソッドで開いた新しいウィンドウを画面の右下に配置することですが、right=0bottom=0の設定は機能しません。 widthheightを変更window.open()でウィンドウを配置できない

は違いますが、topbottomrightまたはleftを変更することは、まだトップ左側の隅にある窓の開口部になります。

なぜこれがあり、右下にウィンドウを配置するのですか?

window.open('https://google.com', '_blank', 'location=yes, height=250,width=550, right=0, bottom=0, scrollbars=yes,status=yes'); 
+0

私の答えをテストできましたか?あなたは持っている問題を解決しましたか? –

答えて

1

新しいウィンドウの内側の高さと幅から高さと幅を引いた値を左上と左に設定する必要があります。

<script> 
    function OpenMe(){ 
    var height = 250; 
    var width = 550; 
    var top = window.innerHeight-height; 
    var left = window.innerHeight-width; 
    window.open('https://google.com', '_blank', 'location=yes, height=250,width=550, top='+top+', left='+left+', scrollbars=yes,status=yes'); 
    } 
</script> 
関連する問題