jqueryといくつかのjsを使用して、ウィンドウのサイズ変更を動的に管理することで、これに対する解決策を作成しました。基本的に、この関数conflayout()
はセットアップを管理します。これは基本的に、ウィンドウのサイズが変更されるたびに呼び出され、元の設定を開始するときにも1回呼び出されます。
デザインが流動的になるセットサイズを変更するには、800を変更します。
if (window.innerWidth > 800) {
好きな数に。
画面の幅がその数よりも小さくなると、divがその内容にラップされ、そのコンテンツはbody
静的なままのラッパーとして機能します。
実例:
http://thepelican.me/liquidcssexample.html
js:
var waitForFinalEvent = (function () {
var timers = {};
return function (callback, ms, uniqueId) {
if (!uniqueId) {
uniqueId = "Don't call this twice without a uniqueId";
}
if (timers[uniqueId]) {
clearTimeout (timers[uniqueId]);
}
timers[uniqueId] = setTimeout(callback, ms);
};
})();
$(window).resize(function () {
waitForFinalEvent(function(){
conflayout()
//...
}, 1, "reloadproperties");
});
function conflayout() {
if (window.innerWidth > 800) {
$('#left').width((window.innerWidth-$('#sidebar').width())+1)
$('#left, #sidebar').css({minHeight: window.innerHeight-$('#header').height()})
$("#wrapper").unwrap();
$('#wrapper').css({width: 'auto !important'});
}
else
{
if($('#contain').size() < 1) {
$('body').wrapInner('<div id="contain" />');
}
$('#wrapper').css({width: '800px !important'});
$('#contain').css({width: '800px',position: 'fixed', height: '100%' })
}
}
$(document).ready(function() {
conflayout()
});