更改窗口大小,重新加载微博发布框

时间:2021-09-14 08:32:09
<script type="text/javascript">
window.onresize = function () {//窗口尺寸发生变化
    loadWeiboBox();
}

function loadWeiboBox() {
    var w = jQuery("#weibobox"), w_w = parseInt(6000 * Math.random()), w_h = '500';
    var w_src = "http://widget.weibo.com/livestream/listlive.php?language=zh_cn&width=" + w_w + "&height=" + w_h + "&uid=...";
    var c = '<iframe id="weibobox" width="' + w_w + '" height="' + w_h + '"  frameborder="0" scrolling="no" src="' + w_src + '"></iframe>';
    w.empty().html(c);
}
window.load = loadWeiboBox(); //js初始化
</script>

 

更改窗口大小,重新加载微博发布框