On other browsers $(element).css('top') will return auto, but in firefox it return a specific value. How to find out if top, right, bottom, left is auto or a specific value on firefox?
Asked
Active
Viewed 729 times
0
-
1Cannot reproduce: `$('body').css('top')` returns `"auto"` for me in Firefox 15.0.1 (on Stack Overflow, which is using jQuery 1.7.1). – Rob W Oct 06 '12 at 09:08
-
You didn't ready my question carefully... – StoneHeart Oct 06 '12 at 09:10
-
Related: [***jquery $('selector').css('top') returns different values for IE, firefox and Chrome***](http://stackoverflow.com/questions/7891824/jquery-selector-csstop-returns-different-values-for-ie-firefox-and-chr) – amiregelz Oct 06 '12 at 09:10
-
This because he is not set position: absolute, if position = absolute, the results is the same on all browser, except the firefox – StoneHeart Oct 06 '12 at 09:11
-
2@StoneHeart Your question states that `$(element).css('top')` returns "auto" on other browsers, but a *specific value in Firefox*. I tried one snippet to confirm your observation, which contradicted your statement. Can you provide a test case which proves your point (http://jsfiddle.net/ for example)? – Rob W Oct 06 '12 at 09:12
-
@RobW: Sorry, I misunderstood, I managed to make it work on firefox http://jsfiddle.net/rerefreelancer/h69UF/7/ – StoneHeart Oct 06 '12 at 09:22
3 Answers
3
Here is tricky way to check if top, right, bottom, left is auto or a specific value on firefox

StoneHeart
- 15,790
- 32
- 67
- 84
-
Nice, maybe you can include the full code in your answer for future reference? – Giona Oct 06 '12 at 10:47
0
Maybe a way without jQuery will do the work for you?
document.getElement...(...).style.top
In addition maybe http://api.jquery.com/category/offset/ will help you (although it doesn't fit your question).

g4rf
- 11
- 7
0
Suppose your element is DIV then
<div id="check123" style="top: auto;">
test
</div>
<script>
alert($('#check123').css('top'));
</script>
same as you can check left, right, bottom.

harsh4u
- 2,550
- 4
- 24
- 39