0
http://grab.by/1rI8image ne reflète pas ses propriétés
j'ai écrit un script jQuery afin que l'image de fond sera toujours l'échelle et ne sera jamais montrer une tache blanche.
function runIt() {
currentHeight = $("#bg").height() //useless for you
currentWidth = $("#bg").width() //useless for you
ccurrentHeight = $("#cover").height() //useless for you
ccurrentWidth = $("#cover").width() //useless for you
wcurrentHeight = $(window).height() //useless for you
wcurrentWidth = $(window).width() //useless for you
$("#auto").empty() //useless for you
$("#auto").append('BG Current Height:"'+currentHeight+'"Width"'+currentWidth+'"<br \>') //useless for you
$("#auto").append('Cover Current Height:"'+ccurrentHeight+'"Width"'+ccurrentWidth+'"<br \>') //useless for you
$("#auto").append('Window Current Height:"'+wcurrentHeight+'"Width"'+wcurrentWidth+'"') //useless for you
if ($("#bg").height() < $(window).height()) {
// $("#bg").empty() //useless for you
// $("#bg").append('<img src="'+imgPath+'" style="height:100%" />') //useless for you
$("#bg").css({
width: $("#cover").width(),
height: "auto"
})
}
else {
// $("#bg").empty() //useless for you
// $("#bg").append('<img src="'+imgPath+'" style="width:100%" />') //useless for you
$("#bg").css({
height: $("#cover").height(),
width: "auto"
})
}
}
setInterval(runIt, 50);
Quelqu'un at-il des idées pour expliquer pourquoi cela ne fonctionne pas correctement?
Merci, Switz
Le code HTML/CSS en soi constituerait un bon ajout à cette question ... – jchapa