Следующая JS должно помочь:
function resizeBackground()
{
var targetWidth;
var targetHeight;
if (typeof window.innerWidth != 'undefined')
{
targetWidth = window.innerWidth,
targetHeight = window.innerHeight
}
else if (typeof document.documentElement != 'undefined'&& typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0)
{
targetWidth = document.documentElement.clientWidth,
targetHeight = document.documentElement.clientHeight
}
else
{
targetWidth = document.getElementsByTagName('body')[0].clientWidth,
targetHeight = document.getElementsByTagName('body')[0].clientHeight
}
var background = new Image();
background.src = document.getElementById("backgroundImage").src;
var target = document.getElementById("backgroundImage");
var sourceWidth = background.width;
var sourceHeight = background.height;
if (targetWidth/sourceWidth > targetHeight/sourceHeight)
{
target.width = targetWidth;
target.height = sourceHeight * (targetWidth/sourceWidth);
}
else
{
target.width = sourceWidth * (targetHeight/sourceHeight);
target.height = targetHeight;
}
}
window.onload = resizeBackground;
window.onresize = resizeBackground;
Затем вставьте DIV где вы хотели бы вам изображение так:
<div id= 'backgroundimage'></div>
И, наконец CSS:
#backgroundimage {background-image:url(image.jpg); width:100%;}
вы пробовали что-нибудь? Что вы предлагаете использовать для этого? – Seth
Ну, я попробовал просто установить ширину изображения на 100%, но он по-прежнему достигает высоты эффекта ... Не уверен, что изображение должно быть определенного размера или если оно связано с плагином jquery. –
Пожалуйста, нажмите F12 в Google Chrome, посетив страницу, вы увидите все, что вам нужно. –