/    Sign up×
Community /Pin to ProfileBookmark

How to determine if text in DIV block is in view or goes hidden

In a JSP page, I defined a <DIV block as:

<div style=”width: 100px; height: 510px; overflow: auto>

….

</div>

My case is like this, only if the text goes hidden(non-viewable), then the DIV block need to scrollTop to bring the text to view; If the text already in view, I do not need to scroll.

But how can I determine if certain text within the DIV is still in the view (or become hidden).

Thanks

Scott

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@tranzparentlApr 03.2007 — I'm not sure about the scrollTop thing but I have something similar and not sure that I really needed it.

Is this similar to what you were looking for?

http://tryptechnics.com/temp/div/
Copy linkTweet thisAlerts:
@scottjsnauthorApr 03.2007 — Thanks for the help.

Actually, this is what I am looking for:

<DIV......>

aaaaa

bbbbb

ccccc

ddddd

eeeee

</DIV>

Now, the line: [B]eeeee [/B]goes out of the view area, hence hidden and non-viewable.

What I want to know, if how can I use the code to dynamically test if line: [B]eeeee [/B]is vieable or not. But I do not know how to do it?


Thanks


Scott
×

Success!

Help @scottjsn spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...