load is not working in jquery, help please
I am trying to fix one jquery issue my code is
<script language="javascript">
$(document).ready(function() {
//if the document is ready
$('#img').load(function() {
开发者_StackOverflow中文版 //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>
This scripts works in all browsers except IE and opera, How can I fix this issue ? Actually I want to set the image vertically middle in a container (div)
Thank you guys
try
pic_real_height = $(this).height();
精彩评论