###発生している問題・エラーメッセージ
JavaScript初心者です。
カラーボックスでコンテンツを縦横比固定で表示させたいのですが、レシポンシブ対応にする際、ウィンドウサイズに対して横90%だとすると縦を算出して縦横比を守ったまま表示してほしいのですが、どうしたらよいか分かりません。
希望の縦横比は16:9です。
お力貸してください!
###該当のソースコード
<script> $(document).ready(function(){ $("#click").click(function(){ $('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here."); return false; }); if (window.matchMedia( '(max-width: 736px)' ).matches) {$("クラス名").colorbox({iframe:true, width:'90%', height:'問題箇所'});} else {$("クラス名").colorbox({iframe:true, innerWidth:640, innerHeight:390,});} }); </script>
回答1件
あなたの回答
tips
プレビュー