0

Basically. I'm building a Tumblr theme with flipping panels based on a site I made for a hackathon. Tumblr will only give me the contents of a text post as a massive string. But I want it truncated to like 200 characters so the contents will all fit on one "panel".

(The URL for the theme at the moment is http://jackwantshugs.tumblr.com/ and the text post is the one on the top left.)

I'm not asking how to simply truncate a post. I want to know how to just include a script at the bottom of the document that will truncate all posts with the class "textposttext" Can anyone help?

Jack Spence
  • 97
  • 1
  • 8

1 Answers1

1

This is probably what you are looking for

string.substring(from, to)

in other words use it like this

var myString = "really long string and things and what not";
console.log(myString.subString(0, 6));  ///will log "really"

You can read more here.

Sergio
  • 28,539
  • 11
  • 85
  • 132
Subtubes
  • 15,851
  • 22
  • 70
  • 105