<!--
var viewportwidth;
var viewportheight;
// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
if (typeof window.innerWidth != 'undefined')
{
viewportwidth = window.innerWidth,
viewportheight = window.innerHeight
}
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
else if (typeof document.documentElement != 'undefined'
&& typeof document.documentElement.clientWidth !=
'undefined' && document.documentElement.clientWidth != 0)
{
viewportwidth = document.documentElement.clientWidth,
viewportheight = document.documentElement.clientHeight
}
// older versions of IE
else
{
viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
viewportheight = document.getElementsByTagName('body')[0].clientHeight
}
document.write('<style>.desktop{ height:'+viewportheight+'px;}</style>');
//-->
выходJquery/Javascript рассчитать
.desktop { height:687px;}
но все его видовой экран. Я хочу это так: height = + viewportheight + - 30 = value. и я хочу обратиться к .desktop как этот .desktop {высота: значение;}
Обновление 1
я просто пытаюсь изменить, как это.
if (typeof window.innerWidth != 'undefined')
{
viewportwidth = window.innerWidth,
viewportheight = window.innerHeight,
height = viewportheight - 30,
width = viewportwidth
}
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
else if (typeof document.documentElement != 'undefined'
&& typeof document.documentElement.clientWidth !=
'undefined' && document.documentElement.clientWidth != 0)
{
viewportwidth = document.documentElement.clientWidth,
viewportheight = document.documentElement.clientHeight,
height = viewportheight - 30,
width = viewportwidth
}
// older versions of IE
else
{
viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
viewportheight = document.getElementsByTagName('body')[0].clientHeight,
height = viewportheight - 30,
width = viewportwidth
}
document.write('<style>.desktop{ width:'+width+'px ;height:'+height+'px;}</style>');
и его работа для меня. , но если кто-нибудь здесь лучше, просто скажите мне.
Пожалуйста, примите ответ или написать свой собственный ответ и принять его, чтобы указать, что проблема решена. См. [Как работает прием ответа?] (Http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) – Antony
О, о том, что я напишу. – Anggagewor