Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    detecting scroll-bars on DIV

    Hi all,

    I having a wrapper DIV (certain width say 400px) and i have some child DIVS which i want to add to it. And i want it to have a maximum height of 600px say.

    I DONT want the wrapper DIV to have vertical scroll bars so i would like to add as many child DIVS (which contain text of indiscriminant length) until i can somehow detect that the wrapper has overflowed (ie the scrollbars have been implemented !) if it has then remove the last one and dynmically create a new DIV, and continue the cyclw until exhausted of child DIVS.

    Have i explained it lucidly enuf? Hope so

    so.....

    (Question 1)

    Is it possible to detect 'on the fly' that a DIV has acquired scroll bars? and if so how !!


    (Question 2) Related

    if i have a wrapper div, say with id wrapperDiv (amazing imagination ), populated with child divs, childDiv1, childDiv2, childDiv3, (added using DOM)etc and a child div is not in view how can i scroll so a invisible div, not currently in view, comes to be displayed the top of the wrapperDiv?

    I beleive i can use something like scrollTo?? I seem to be confused how to get a child element, specifically, to be moved to the top of the view

    Thanx in advance

  • #2
    Senior Coder
    Join Date
    Feb 2004
    Posts
    1,206
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't know the answer to question 2 (off hand..), but the answer to question 1 (I think..) is:
    [code]
    <div style="overflow:hidden;">
    [code]

    scrollTo uses coordinates, so if you can ensure that your child divs are always at some particular coordinate, then you might be able to get it to work. I'm not sure if scrollTo works in DIVs, you may need to use an iFrame..

    Hope that helps,
    Sadiq.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •