Tuesday, September 28, 2010

width and top of invisible element in IE may give 0 zero using jQuery

jQuery element width for invisible element in IE will not give exact result.
But  in Firefox it works perfectly.

$(e).width() //using jQuery to get the width.

i have used a way to solve this one by showing, calculate width and hiding the element.

$(e).
show(). // to get the width of visible element ==> IE issue
                    css({zoom: 1,left:$(e).position().left-parseInt($(e).width()),top:$(e).position().top}).
                    hide().

jQuery animation effect slide bug in IE 7

The best example is for this ind of bug is presented by ryan as follows

http://www.ryancramer.com/misc/jquery_slide/#

the slide effects of jquery may not work 100% correctly in IE 6 & IE 7 . Effects are misbehave like effects complete till 50% or so...


So i have used show call back function to rescue the bug.. Though it is 100% not correct but once the effects renders second time it works perfectly.

So make it show and show it again..with less duration.. to avoid flickering effect.

$("my_element").show(1,function(){$(this).show("slide",{direction:"right"})})