adam griffin
Posts: 0
Joined: Tue May 21, 2013 8:44 pm

How can I right code to css using javascript?

This is the code with in my html container :

div class = "ticker-container"
div class = "ticker-text"
Some text



and this the code for CSS:

.ticker_container {
width: 100%;
height: 2.9%;
border: 1px solid;
overflow: hidden;
}
.ticker-text {
height: 150%;
white-space:nowrap;
display:inline-block;
}

I would like to get the length of the text that is inputed into the html container. This is the code I have for javascript right now, but its not getting width.

var width = $('.ticker-text').width(),
containerwidth = Appery('ticker_container').width(),
left = containerwidth;

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

How can I right code to css using javascript?

Hi -

Please clarify - do you want to get the text string length or do you want to get dimensions of a div element?

adam griffin
Posts: 0
Joined: Tue May 21, 2013 8:44 pm

How can I right code to css using javascript?

I want to get the text string length. Sorry for the misunderstanding.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

How can I right code to css using javascript?

Hi Adam,

You can use this code:prevar len = $('.ticker-text').text().length;/pre

adam griffin
Posts: 0
Joined: Tue May 21, 2013 8:44 pm

How can I right code to css using javascript?

It works!, But now I have the problem I cant get the text from the html to start from the right side of the container. It restarts the text flow at the left when I want it to go far left the restart from the right like a sports ticker

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

How can I right code to css using javascript?

Hello! Sorry, i'm not sure I understand. Could you clarify what do you mean? Screenshots would help.

Return to “Issues”