我想检查屏幕宽度是否高于 1024 像素,设置侧边栏 + 50px
我尝试了这段代码(但侧边栏没有加载到 1024+):
<?php $arjunaOptions = arjuna_get_options(); ?>
<?php
//calculate sidebar and content area ratio
if ($arjunaOptions['sidebarDisplay'] != 'none') {
$available = 920;
$available2 = 970;
$contentArea = $arjunaOptions['contentAreaWidth'];
$sidebar = $available - $contentArea;
$sidebarlarge = $available2 - $contentArea ;
$sidebarLeftRight = floor(($sidebar - 50) / 2);
print '<style type="text/css">
@media screen and (max-width: 1024px) {
.contentWrapper .contentArea {width:'.$contentArea.'px;}
.contentWrapper .sidebars {width:'.$sidebar.'px;}
.contentWrapper .sidebarLeft, .contentWrapper .sidebarRight {width:'.$sidebarLeftRight.'px;}
}
@media screen and (min-width: 1025px) {
.contentWrapper .contentArea {width:'.$contentArea.'px;}
.contentWrapper .sidebars {width:'.$sidebarlarge.'px;}
.contentWrapper .sidebarLeft, .contentWrapper .sidebarRight {width:'.$sidebarLeftRight.'px;}
}
</style>';
}
?>