当文本溢出时选择文本 [英] Marquee Text When Text Overflows
本文介绍了当文本溢出时选择文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
很好的我的问题。假设我有3个div标签,都是100像素宽:
well heres my problem. Lets say i have 3 div tags, all are 100pixels wide:
<--- DIV WIDTH --->
Text in div 1
Text in div two, it overflows
Text in div three
<--- DIV WIDTH --->
现在,我有这个css的divs:
Now, currently i have this css for the divs:
width:100px;
overflow:hidden;
我想做的是如果文本溢出,它滚动像一个选框,所以所有的文本如果你等一下,看看。
What i want to do is if the text overflows, it scrolls like a marquee so all the text can be seen if you wait a little bit. But i only want the marquee to show if the text overflows.
我将如何做?
Thx ,Tony
Thx, Tony
推荐答案
解决条件部分
var el = $('your element');
if (el.get(0).scrollWidth > el.width()) {
// Your marquee code here
}
这篇关于当文本溢出时选择文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文