Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私はjQueryとHTMLに慣れていないので、おそらくこれは非常にばかげた質問ですが、jQueryを使用してドキュメントまたはウィンドウの幅を変更できるかどうかだけ知りたいですか?
このようなことが可能ですか:
$(document).ready(function() { $(document).width( $(window).width() ); });
ありがとうございました
私が理解しているように、$(document).width()は読み取り専用であり、幅の値は更新されません。あなたはより良い運を持っているかもしれません:
$('body').width( $(window).width() );
ただし、ドキュメント/ページのルート要素がビューポートよりも大きくなるようにスタイル設定されていない限り、これは効果がありません(水平スクロールが不要になります)。