Reputation: 534
To be precise on creating a slider, I got stuck in a situation (though I completed my task with some other trick) on which I would like to gather some more information.
So, I was calculating value from right, of the inner div which is actually getting scrolled. So that when it ends, I will scroll back again.
The value I was confused about, is:
jQuery(element).css("right").toString();
It returns "auto" in chrome while a value like-1200 in firefox. Does it have to do with any limitation in chrome? Any explanation would be appreciated.
Upvotes: 1
Views: 89
Reputation: 121
I tested on firefox and chrome and in both I get the same result: "auto". I don't know your markup or anything but I don't see the difference you notice with this browsers. (Firefox 37.0.1 y Chrome 50.0.2661)
Anyway if you want to know in pixels the right of an element you can do it with position and width.
(jQuery(element).position().left + jQuery(element).width()).toString();
Of course this only gives you the right position of the element. I hope that's is what you need.
In order to seek what's is happened in chrome or firefox so they throw a diferent response on jQuery(element).css("right")
I update my firefox (46.0.1) so now chrome and firefox are update.
I made a simple & stupid jsFiddle so we can see the differences together with a common source.
When I run this jsFiddle in chrome or firefox I get the same result: "auto". Please check if you are getting the same result as I. Maybe the problem is on how chrome and firefox are dealing with the markup and that explain the behaviour. Coul you please provide a jsFiddler or similar where this problems happen?
Upvotes: 3