[jQuery] .attr('height')
[jQuery] .attr('height')
Hi all, I'm building a gallery, and so far it works in every browser
except Internet Explorer,
The problem is that IE (burns to hell) doesn't read these variables
var height = $('#'+litebox+'>img.lite').attr('height');
var width = $('#'+litebox+'>img.lite').attr('width');
the alert (alert(litebox+'-'+height + '-'+width );) returns img1-0-0
and i really don't know why....
I tried to change the attributes height and width, in title and alt,
giving the dimensions to the image in that way , and it works, but I
cannot use title and alt to assign dimensions.
I just want to understand why it does not work..
Below a part of the js code:
$('.img_in li a ').click(function () {
$('.bg_thumbs').show().css({'opacity':'0','z-
index':'999'}).fadeTo(200,0.4)
$('.thumbs_big ').css({
'background-color':'#000',
'background-image':'url(css3/ajax-loader.gif)',
'background-repeat':'no-repeat',
'background-position':'center'})
var litebox = $(this).attr('rel');
var height = $('#'+litebox
+'>img.lite').attr('height');
var width = $('#'+litebox
+'>img.lite').attr('width');
$('#'+litebox).show().css('opacity',0).animate({
borderWidth : '4px',
top :'50%',
height : (height ) + 'px' ,
width : (width ) + 'px' ,
marginLeft : '-' +((width )/2) +'px',
marginTop : '-' +((height )/2) +'px',
opacity : 1
},600)
alert(litebox+'-'+height + '-'+width );
$('#'+litebox).queue(function(){
$('.thumbs_big img').css({'opacity':'0' ,'display' :
'block'}).fadeTo(300,1)
$('.thumbs_big ').css('background','#000')
$('#'+litebox).dequeue()
});
return false;
});
and here a part of html code:
<li id="img_1" title="thumb_1">
<a href="#" rel="img1"><img src="images/diegovalobra.jpg" alt="prova"
width="200" height="139" id="thumb_1"/></a>
</li>
<span class="thumbs_big" id="img1">
<img src="images/diegovalobra_b.jpg" alt="prova" width="900"
height="585" class="lite"/>
<span class="thumbs_close" title="chiudi"><img src="css3/close.png"
alt="prova" width="30" height="30" /></span>
</span>
I've tested the code in firefox, opera, google chrome, safari(pc) and
works fine...
IE sucks
every kind of help is appreciated, thanks to all :)
Diego