使用截断文本插件时出现空格
我尝试将 jtruncate 插件分别应用于同一页面上的 4 个文本区域。第一个文本区域对齐,其余部分右对齐。
已在 jtruncate 插件 博客上留下评论,但是还没有听到任何消息。
我的问题是...
A)合理的文本位,在第二次和后续显示中,文本没有正确地证明沿顶行留下大量空白,并由前两个单词分隔。
B) 在右对齐的文本位上,在第二次和后续显示时,顶行的第一个单词不会跳回到顶行,而是停留在文本底行的前面。在它应该在的位置,在顶行的开头(左上),留有一个空白。
很难解释所以......
我拼凑了一个简短的 jsfiddle 应该在所有三个方面表明我的意思。你能帮忙吗?
我对 jQuery 和一般编码非常陌生,通常我不理解编码术语或指令,所以请用简单的术语为我解释一下:)
Am attempting to apply jtruncate plugin seperately to each of 4 text areas on same page. First text area alignment is justified, rest are right aligned.
Have left comment on the jtruncate plugin blog but heard nothing yet.
My issues are...
A) The justified text bit, on second and subsequent reveals, text doesnt properly justify leaving a massive white space along the top line, bookended by the first two words.
B) On the right aligned text bits, on second and subsequent reveals, the first word of the top line wont jump back up to top line, staying at the front of the bottom line of text. Where it should be, at the beginning of the top line, (top left), there is a white space left.
Hard to explain so...
...I've cobbled together a short jsfiddle which should show what I mean on all 3 counts. Can you assist?
I am VERY new to jQuery and coding in general, often I dont undertand coding terminology or instruction, so please explain things in simple terms for me :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我已经查看了更多内容,对于第一部分(语句文本),您可以对 CSS 进行以下更改
来解决问题。
http://jsfiddle.net/QLgqe/
更新:
又看了一些。第一次之后的“更改”是因为您从没有设置显示的元素开始,将其设置为无,然后将其设置为阻止。如果您从块开始,您将看不到从一个显示到下一个显示的任何变化。有了这个,您应该能够调整其余的样式表以按照您希望的方式工作。
这是小提琴
http://jsfiddle.net/QLgqe/1/
I've looked some more and for the first part (statement text) you can make the following change to the CSS
Which solves the problem.
http://jsfiddle.net/QLgqe/
Update:
Looked at it some more. The "change" after the first time is because you are starting with an element that has no display set, setting it to none and then setting it to block. If you start with it in block you will see no change from one display to the next. With this you should be able to adjust the rest of your style sheets to work however you want them to work.
Here is the fiddle
http://jsfiddle.net/QLgqe/1/
我整理好了!这是由于动画开始了新的一行。应该仔细检查插件博客上的文字〜一个有益的教训。
我设法解决了这个问题,通过在我的 html 中添加一种副标题,它不是 H1 H2 等,而只是粗体文本。
然后我花了几个小时处理空的 P 标签、换行符和空格。空白:预换行;直到我得到我想要的。花了一段时间,但现在效果很好!
感谢所有帮助我的人,你们激励我不要放弃。
I sorted it! its due to animation starting a new line. Should have scrutinised the text on the plugin blog ~ a salutary lesson.
I managed to work around the problem, by adding a kind of subtitle in my html, which wasn't an H1 H2 etc but simply bold text.
Then I spent hours tooling around with empty P tags, line breaks & white-space: pre-wrap; until I got what I wanted. It took a while, but it works fine now!
Thanks for all the help folks, you inspired me to not give up.