Jump to content

Javascript and css overflow question


cip6791

Recommended Posts

I used javascript to display different divs in one div. The problem is that I don't need overflow:scroll; to be activated all the time. Code below. Now ... since the overflow:scroll is set in css for test_two, I don't know how to deactivate the scroll for certain divs which have less content and don't need to scroll but still get the blank scroll bar on the left side. Hope anybody can give me a hand with this one.

 


<div id="test_two" style="background-image:url(../../../img/clenser_background.gif); repeat: repeat-y;">

<div id="navigation">
<ul>
<li><a href="#" onclick="pageSwitch(1); return false;">Link1</a></li>|
<li><a href="#" onclick="pageSwitch(2); return false;">Link2</a></li>|
<li><a href="#" onclick="pageSwitch(3); return false;">Link3</a></li>|
<li><a href="#" onclick="pageSwitch(4); return false;">Link4</a></li>
</ul>
</div>
<div id="page1" style="display:block;"></div>

<div id="page2" style="display:none;"></div>

<div id="page3" style="display:none;"></div>

<div id="page4" style="display:none;"></div>

 

CSS code for test_two

#test_two {
position:absolute;
top:0;
left:227px;
width:500px;
height:350px;
overflow:scroll;
overflow-x:hidden;

}

Link to comment
Share on other sites

I don't want overflow visible on some of them. That's my only problem. And the display:none; is set so the other divs will not show up until the link is clicked. This is the link.

 

http://pixeltennis.com/produse_html/sub_produse/roc_demachiant/roc_lapte_demachiant_piele_normala.html

 

The "Produsul" and the "Sfatul RoC" are the two links that i'm working with.

 

"Produsul" doesn't have enough text to make the scroll bar scroll down. But it still shows up. I just want to hide it.

Link to comment
Share on other sites

"Produsul" doesn't have enough text to make the scroll bar scroll down. But it still shows up. I just want to hide it.

 

If you don't want the scrollbars on that div, don't use the style overflow:scroll. Seeing your code now, it would seem you want page1 to not have the scrollbars so it would be the same code that I posted but for the div with id="page1".

 

If your question is how to dynamically provide a scrollbar if the content overflows and not show the scrollbar if it doesn't need to scroll, then, like I said, check the length of the innerText. Let me know if that is the case and I can go more indepth.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.