将 div 上的 j.truncate 与 div P 标签上的动画 marginLeft 结合使用 jQuery
我尝试在 div 内的文本上使用 animate marginLeft,该文本本身由 j.truncate 进行动画处理,但它似乎不起作用。
J truncate 对我来说工作得很好,我的动画边距也剩下了,但结合起来,它们还不能工作。
有答案吗?
这是 j.truncate 本身 http://jsfiddle.net/cress/QLgqe/19/ (使用了不同的文本)
这是动画本身 http://jsfiddle.net/cress/pZ6aL/2/
这是 j.truncate 和 animate 的组合 http://jsfiddle.net/cress/mGnvu/10/
Am trying to use animate marginLeft on text within a div, which is itself being animated by j.truncate, but it doesn't seem to be working.
J truncate is working fine for me and so is my animate margin left, but combined, they dont work yet.
Any answers out there?
Here's j.truncate by itself http://jsfiddle.net/cress/QLgqe/19/ (have used different text)
Here's the animate by itself http://jsfiddle.net/cress/pZ6aL/2/
Here's the combo of j.truncate and animate http://jsfiddle.net/cress/mGnvu/10/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的第一个问题是一些小的语法错误,我在下面的小提琴中为您修复了这些错误。
第二个是您的 DOM 已更改 - jTruncate 插件修改了它所作用的 DIV,以便选择器
$('#works > p')
不再起作用。将其更改为$('#works p')
可以解决问题,但可能并不总是足够具体;将其更改为$('#works span.truncate_more > p')
解决了所有问题。http://jsfiddle.net/mblase75/mGnvu/12/
Your first problem was some minor syntax errors, which I fixed for you in the fiddle below.
The second was that your DOM had been changed -- the jTruncate plugin modifies the DIV it acts on so that the selector
$('#works > p')
no longer worked. Changing it to$('#works p')
would fix things, but might not always be specific enough; changing it to$('#works span.truncate_more > p')
solved everything.http://jsfiddle.net/mblase75/mGnvu/12/