您的位置:首页 > Web前端 > JavaScript

js浮动层的控制

2015-11-02 16:36 513 查看
(function () {
var resizeContentWrapper = function () {
console.group('resizing');

var target = {
content: $('#resizeme')
};

//resize target content to window size, assuming that last time around it was set to document height, and might be pushing document height beyond window after resize
//TODO: for performance, insert flags to only do this if the window is shrinking, and the div has already been resized
target.content.css('height', $(window).height());

var height = {
document: $(document).height(),
window: $(window).height()
};

console.log('height: ', height);

if (height.document > height.window) {
// Scrolling needed, no need to externd the sidebar
target.content.css('height', '');

console.info('custom height removed');
} else {
// Set the new content height
height['content'] = height.window;
target.content.css('height', height['content']);

console.log('new height: ', height);
}
console.groupEnd();
}
resizeContentWrapper();
$(window).bind('resize orientationchange', resizeContentWrapper);
})(jQuery);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: