Setting height of a DIV to correspond with location of anchor inside said DIV
Posted
by
filip
on Stack Overflow
See other posts from Stack Overflow
or by filip
Published on 2011-11-26T01:15:04Z
Indexed on
2011/11/26
1:50 UTC
Read the original article
Hit count: 119
Core issue : http://jsfiddle.net/pipip/P46Xg/
I have a div
container with a few paragraphs of text,
and inside one of these paragraphs is the following anchor <a id="stop" />
The container is set to overflow:hidden
Is it possible with javascript / JQuery to set the height of the container so that the bottom of the container stops exactly at or below the anchor?
Added Depth & Background : http://jsfiddle.net/pipip/yj9dB/
This would be used for a modified JQuery Slider. Where someone using a CMS could type [readmore]
anywhere into the Content field, which would be replaced by the above anchor via PHP. This way they would be easily able to control where the Read More break appears within the container. In the associated example I am hard-coding the height to 75px
, although what I want is for the height to be dependent on the location of the anchor id="stop"
in the text.
Thanks. If this is an awful way to go about it, I'm all ears!
© Stack Overflow or respective owner