2010-07-23 4 views
0

Je suis en train de résoudre un problème de jquery mon code estcharge ne fonctionne pas dans jquery, aider à satisfaire

<script language="javascript"> 
    $(document).ready(function() { 
     //if the document is ready 
     $('#img').load(function() { 
      //if the image is loaded 
      pic_real_height = this.height; 
      //finding the height of the image 
      $('#img').css('margin-top', 150 - pic_real_height/2 + 'px'); //setting the margin-top to align the image verticall middle in the container<br> 
     }); 
    }); 
</script> 

Ce script fonctionne dans tous les navigateurs sauf IE et Opera, Comment puis-je résoudre ce problème? En fait, je veux mettre l'image verticalement du milieu dans un récipient (div)

Merci les gars

Répondre

1

essayer

pic_real_height = $(this).height(); 
+0

En fait $ ('# img'). Charge (fonction() a la problème – milan

+0

quel est le problème? – Reigel