这是视频的网址调整大小的视频帧
<iframe src="http://xxxx.com/embed-xxx-720x405.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="NO" width="720" height="405"></iframe>
我得到这个JS宽度和高度的网址以改变从640像素:
$(window).on("load", function(event){
var w = $(this).width() -50;
if(w <= 640)
$('.videoimg iframe').each(function() {
$(this).attr('src', $(this).attr('src').replace('720', '' + w + ''));
$(this).attr('src', $(this).attr('src').replace('405', '305'));
$(this).attr('width', $(this).attr('width').replace('720', '' + w + ''));
$(this).attr('height', $(this).attr('height').replace('405', '305'));
})
});
它与加载一个网站,但我需要,它应该工作时,我在横向翻转手机,所以人们不需要刷新页面。
大小功能不工作,它应该是类似的东西
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) {
window.addEventListener("orientationchange", function() {
rvlWidth(w);
}, false);
但我不知道如何做到这一点,你有任何的解决方案?
的可能重复[在窗口的JQuery执行调整?(http://stackoverflow.com/questions/9828831/jquery-execution-on-window-resize) –