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 --->
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.
How would i do this?
Thx, Tony
solving the conditional part
var el = $('your element');
if (el.get(0).scrollWidth > el.width()) {
// Your marquee code here
}
$(function(){
$box = $('div.box');
$box.children().each(function(){
if ($box.width() < $(this).width()) {
$(this).wrap('<marquee>');
}
)};
});
Would work in jQuery (I haven't checked it yet. If you have any problems with it reply). Optionally, you could set a scroll attribute in css.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With