How to use jquery .animate() to mock 'text-align:right'
Posted
by
mrwienerdog
on Stack Overflow
See other posts from Stack Overflow
or by mrwienerdog
Published on 2012-03-22T17:25:44Z
Indexed on
2012/03/22
17:29 UTC
Read the original article
Hit count: 159
jQuery
I am building a very simple jquery menu. On hover, I have a menu on the right easing to the left margin of my menu container. This is easy, as the text is left aligned within said container.
However, I also have a menu on the left, and because the links (left justified) are of differing length, the best I can do is adjust the padding to ease the text a uniform amount between links. Therefor, long link text goes to the right edge of the container, buy short text only makes it about half way.
In reading about this, I have learned that you can not modify the text align property as it is non numeric. Is there any other way to do this?
I of course tried to go with:
$('#selector').css('text-align':'right')
but that made the text jump to the right instead of ease.
Is there any way to ensure all links ease to the rightmost margin of the container?
© Stack Overflow or respective owner