Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I want the DIV style to be changed when the contents within this DIV overflow... I have no Idea about doing this. Can anybody please help me how can I?


Any help is appreciated.

Regards,
Sunny_K
Posted
Comments
Sandeep Mewara 18-Jun-12 3:06am    
What is inside the div?
Sunny_Kumar_ 18-Jun-12 3:13am    
there is grid inside the DIV. Number of records are dynamic hence "overflow" property of the DIV is set to "auto" so that scrollbars show up automatically. I want to set It's borders when overflow occurs.
krumia 18-Jun-12 4:21am    
Would CSS max-width and max-height properties help you?
Sunny_Kumar_ 18-Jun-12 4:51am    
no they won't. I want something to occur when overflow happens, some action, change in style and this can not be done by setting max-width or max-height property. anyway, thanks for your time.
krumia 18-Jun-12 4:53am    
I don't think what you say is possible. What exactly are you trying to do. Maybe there's a whole different way to do it.

1 solution

C#
var element = document.getElementById("div1");
if(element.scrollWidth > element.clientWidth)
       element.style.borderStyle="solid"; //whatever change you want to make


only works when the element is set to display:block
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900