|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Getting size of auto sized DIV
Hello !
If a div has the CSS : div {width : auto;} And i do something like this : alert(mydiv.currentStyle.width); it returns : "auto" What i really want is the actual pixel value ... Any ideas ? |
|
#2
|
||||
|
||||
|
width
Hi wexen, welcome to the forums,
Try to get it's "offsetWidth" |
|
#3
|
|||
|
|||
|
That did the trick thank you !
I now have somthing like this : // First loop do some stuff and get the width of the biggest div in the array for(var no=0;no<draggableItems.length;no++){ draggableItems[no].onmousedown = startDrag; draggableItems[no].style.cursor = 'hand'; if(itemWidth < draggableItems[no].offsetWidth) {itemWidth = draggableItems[no].offsetWidth} } // Second loop set all div .style.width attribute to itemWidth for(var no=0;no<draggableItems.length;no++){ draggableItems[no].style.width = itemWidth; } |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > Getting size of auto sized DIV |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|