在我的網站我使用的一個插件,默認情況下發送的iframe變化直列最小高度與屏幕分辨率
<iframe id="ec-frame" allowfullscreen="" style="width: 100%;min-height:659px; height:100%;" src="https://dash.evercam.io/live.view.private.widget?camera=stephens-green&refresh=1&api_id=&api_key=&rtmp=rtmp://media.evercam.io:1935/live/stephens-green?token=qoSoGPwrzLlE0ITuMa2Id_VbCGRYYGAfGJlVZVm_LfA6fcVPcHqbymbJQ9uSMSOiyYtl24i4kHr4tIm_fxfadHVNVN8mxVQ_Xps9rGsIssc=&hls=https://media.evercam.io/live/stephens-green/index.m3u8?token=qoSoGPwrzLlE0ITuMa2Id_VbCGRYYGAfGJlVZVm_LfA6fcVPcHqbymbJQ9uSMSOiyYtl24i4kHr4tIm_fxfadHVNVN8mxVQ_Xps9rGsIssc=" frameborder="0" scrolling="no"></iframe>
由於這一點,內聯最小高度時,屏幕寬度改變這個最小高度保持相同並導致iframe和下方div之間有很大的空間。
我想在調整大小功能
var currentHeight = $("#test > iframe").css('min-height');
$(window).on('resize', function() {
$('#test > iframe').css('min-height', "5px");
});
有能力改變這一點,但我真的不知道/找到如何編輯此動態最小高度爲屏幕寬度的變化,上述功能剛剛設置最小高度到5px,但如果我減去東西
$('#test > iframe').css('min-height', currentHeight - "5px");
這根本不起作用。我想要的是在屏幕寬度的變化最小高度改變爲現在最小高度爲659px,我要動態減去一個值,但不知道如何減去它
你減去從''string''int' currentHeight - 「爲5px」'。你必須做'$('#test> iframe')。css('min-height',parseInt(currentHeight) - 5);' –
把這個放在答案裏,我想把它標記爲正確答案。 非常感謝。 –