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().