いいえ、これにはJavascriptを使用する必要がありますが、それは聞こえるよりもトリッキーです。私はここで、他の週に似た何かをした。私はそれのために作成した関数をよ、あなたはああ
それを再適切なことができるかもしれない、とあなたがいずれかの高さを知っているなら、それはjQueryの
function resize_background(){
var target = $("#background_image");
var window = $(window);
var ratio = 1;
var anchor_point = 200;
var register_point = 400;
if(window.width() > min_width){
ratio = window.width()/min_width;
target.css("marginLeft", 0);
}else{
// center to screen
// For this project, this aint needed.
//var left_margin = (window.width()/2) - (min_width/2);
//target.css("marginLeft", left_margin);
}
// now figure out anchor stuff
var top = ((register_point * ratio) - anchor_point) * -1;
target.width(min_width * ratio);
target.height(min_height * ratio);
target.css("marginTop", top);
$("#trace").text(top);
}
どのようにそれをサイズ変更ハンドラに入れて、ウィンドウのサイズを取得するのですか? – peterchen
私は、 "width =" 100% ""は "十分に良い"という人たちを説得させました。 – peterchen