基本思路:
让DIV浮动起来,利用postion:fixed/absolute,设定height:100%
var $card=$("#cardDetail");
$card.css({"width":"90%"});
var wl=($(window).width()-$card.width())/2;
var leftstr=wl+"px";
var topstr=this.$root.$data.header_h+"px";
$card.css({"position":"absolute","top":topstr,"height":"100%","overflow":"auto"});
博客介绍了让DIV浮动起来的基本思路,利用postion:fixed/absolute并设定height:100%,还给出了相关的代码示例,通过获取窗口宽度和元素宽度计算位置,设置DIV的样式,实现浮动布局。
849

被折叠的 条评论
为什么被折叠?



