내가 크기 조절을 만드는 바빠하지만 다시로드에 처음 쿠키를로드 고정 뭔가 폭 설정 될 때까지 100 %로 전환 :CSS 속성을 설정하는 가장 빠른 방법은 무엇입니까?
//set width from cookie, unfortunately we need todo this on docready because #main-container is not done rendering -_-
var width = $.cookie("width");
// Set the user's selection for the left column
if (width != null) {
if (width == "fluid") {
alert("fluid!");
$('#main-container').addClass('width-fluid');
} else {
$('#main-container').addClass('width-fixed');
}
} else {
$('#main-container').addClass('width-fixed');
};
어떤 아이디어?
감사합니다,
데니스
는 당신이 jQuery를 사용하여 특정 CSS 속성을 설정할 수 있습니다
'! = null'은 중복 된 것처럼 보입니다. 'width == "fluid"와 비교하여 하나의 if-else는 똑같이 할 것입니다. 또한 현재 CSS 속성을 설정하지 않고 클래스를 추가하고 있습니다. 그들은 서로 다른 두 가지입니다. – BoltClock
당신은 우리에게 js를 주었고 그것이 무엇을하는지 우리에게 말했습니다 ... 우리는 또한 html을 가지고 당신이 원하는 것을 알고 있다면 올바른 답을 얻을 확률이 더 큽니다. – jondavidjohn