4 replies [Last post]
gidmeister
gidmeister's picture
Offline
Regular
NY
Last seen: 8 years 28 weeks ago
NY
Timezone: GMT-4
Joined: 2011-03-01
Posts: 47
Points: 93

Is there a way to create a invisible div, fill it with html, then truncate the html so that only the part that fits is left? For instance, suppose I make a div that has a certain height and width and I paste some html into it (programmatically) and then I want to find exactly at what letter or symbol or tag the html ends at. I guess there would be a problem with unmatched tags if the end tag got lopped off, but lets suppose I add those later.

Thanks.

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 2 years 3 weeks ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9776
Points: 3858

Going backwards?

Instead of fitting the text to the container, decide on a word count to include. Alternatively, set the container to {overflow: hidden;}. The first is a programming solution, the latter a css solution.

Better yet, tell us what you want to accomplish instead of asking how to do what you've decided is the solution.

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

gidmeister
gidmeister's picture
Offline
Regular
NY
Last seen: 8 years 28 weeks ago
NY
Timezone: GMT-4
Joined: 2011-03-01
Posts: 47
Points: 93

Thanks for the info

I'm trying to make a kind of scroller, but this scroller does not have scrollbars, it has a NEXT button and a PREV button that moves to the next (or previous) chunk of text in the window. It would display html text, and maybe images, though I'm not sure that would fit.
Anyway, the problem is that I would have to not overspill my scroller boundaries.
So I have a huge html document, and I want to show only little bit at a time, that's where the problem arises.

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 2 years 3 weeks ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9776
Points: 3858

Without getting into specifics...

This would seem to be a javascript issue, which is generally beyond the purview of this forum. Try searching for "javascript slider".

On the whole, I'd recommend staying with scrolling. Everyone knows how to scroll, and it is a Good Thing® to use the technology that your visitors know. But, it's your site to do with as you think best. Wink

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

helldog2004
helldog2004's picture
Offline
Enthusiast
Netherlands
Last seen: 6 years 34 weeks ago
Netherlands
Timezone: GMT+2
Joined: 2014-03-02
Posts: 205
Points: 239

Well if you would like to

Well if you would like to place buttons as a scroller to show new chunks of text you might want to take a look over here: Vectordiv.

Hope this contains your question.

Check Maximum Webdesign for your online solutions