我有一个小函数,可以用滑动效果将内容从左边切换到右边。不幸的是,两个div
对象(与inline-block
)由于它们的大小,在滑动时不会彼此对齐,但其中一个显然总是在另一个的下方。
看到 jsfiddle代码
我试了如下:
- 设置
float:left
没有任何帮助 - 将
div
定位为绝对位置,这有助于但也会在从右向左滑动时产生一些意想不到的行为(您自己试试) - 延迟/排队动画,工作,但不是真正的用户友好的延迟
我还想提一下,当你想让你的对象都居中时,浮动和不同的定位并不是很有用,所以我更喜欢另一种解决方案。
也许你们有一个想法,我怎么才能使这个平滑,使div
对象保持在一条线上?!
做了很多更改,抱歉,但试试这个:
http://jsfiddle.net/jcZ6J/9/
还要注意的是,你不应该把div
放在a
标签里面。