Image extensible mal géré par IE

Résolu
ANTHURIUMRE Messages postés 93 Date d'inscription   Statut Membre Dernière intervention   -  
ANTHURIUMRE Messages postés 93 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,

J'essaie de mettre en fond d'écran d'un site une image extensible. J'utilise Jquery. C'est impeccable avec FF, Chrome mais avec IE, l'image s'affiche en haut et dénature mon site.

Voici ci-dessous comment j'ai procédé. Pourriez-vous m'aider s'il vous plaît. Merci pour votre participation.

<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>




et sur mon serveur j'ai mis la librairie jquery. Mais IE affiche mon image en entête contrairement aux autres navigateurs qui l'affiche très bien.
A voir également:

1 réponse

ANTHURIUMRE Messages postés 93 Date d'inscription   Statut Membre Dernière intervention   2
 
J'avais omis de changer l'extension de mon image dans mes différents scripts. Tout fonctionne maintenant.

Merci quand même.
0