0
如何使用jQuery.I更改图像分辨率使用css/php在身体背景上应用了图像。现在我想将屏幕高度和宽度应用于图像,因此图像在全窗口中显示。 Actuly我没有使用重复的风格。图像高度宽度问题
使用的代码是:
<style type="text/css">
<?php
global $post;
if (has_post_thumbnail($post->ID)) {
$image_id = get_post_thumbnail_id($post->ID);
$bg_src = wp_get_attachment_image_src($image_id, 'full');
?>
body { background: #000000 url("<?php echo $bg_src[0]; ?>") no-repeat center top fixed !important; }
<?php } else { ?>
body { background: #000000 url("<?php bloginfo('template_directory') ?>/img/bg_img.jpg") no-repeat center top fixed ; }
<?php } ?>
</style>
我的屏幕的高度和宽度使用此,我们无法理解什么来实现它的形象得到。
var p_browserHeight= screen.height;
var p_browserWidth= screen.width;
jQuery('body.archive').css('height',p_browserHeight+'px');
jQuery('body.archive').css('width',p_browserWidth+'px');
你是否意识到如果你改变了两者,你会弄乱纵横比?如果您只更改宽度,则高度将为需要的值 – mplungjan 2010-09-17 14:36:02
最后,CSS3具有背景大小的属性。一旦在浏览器中获得广泛支持,将高/宽度设置为100%会更容易。 – 2010-09-17 15:45:13
是的。直到那时,你需要一种不同的方法。 – Traingamer 2010-09-17 18:23:33