Bonjour,
J'ai suivi les recommandations du site Alsacréation pour "Un arrière-plan extensible intelligent".
Cela marche très bien avec FF et Chrome et remercie par ailleurs Alsacréation pour le script.
Toutefois IE 8 m'affiche mon image au-dessus de mon site. Pourriez-vous me venir en aide s'il vous plaît. Merci par avance pour votre aide
J'ai fais comme suit sur ma page :
J'ai suivi les recommandations du site Alsacréation pour "Un arrière-plan extensible intelligent".
Cela marche très bien avec FF et Chrome et remercie par ailleurs Alsacréation pour le script.
Toutefois IE 8 m'affiche mon image au-dessus de mon site. Pourriez-vous me venir en aide s'il vous plaît. Merci par avance pour votre aide
J'ai fais comme suit sur ma page :
<html>
<head>
<img src="mana.jpg" class="superbg" />
<script src="jquery.js" type="text/javascript"></script>
<script src="script/background.js" type="text/javascript"></script>
<script>
function redimensionnement(){
var $image = $('img.superbg');
var image_width = $image.width();
var image_height = $image.height();
var over = image_width / image_height;
var under = image_height / image_width;
var body_width = $(window).width();
var body_height = $(window).height();
if (body_width / body_height >= over) {
$image.css({
'width': body_width + 'px',
'height': Math.ceil(under * body_width) + 'px',
'left': '0px',
'top': Math.abs((under * body_width) - body_height) / -2 + 'px'
});
}
else {
$image.css({
'width': Math.ceil(over * body_height) + 'px',
'height': body_height + 'px',
'top': '0px',
'left': Math.abs((over * body_height) - body_width) / -2 + 'px'
});
}
}
$(document).ready(function(){
// Au chargement initial
redimensionnement();
// En cas de redimensionnement de la fenêtre
$(window).resize(function(){
redimensionnement();
});
});
</script>
</head>
</html>