#10994 closed enhancement (duplicate)
Extend the functionality of outherWidth to be able to set the objects width
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.7.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
i'm writing here because there are some situations where you need to set the width/height of an object to fit a specific size.
if you use the width/height function the object will have width+paddin+border+margin
for my personal use i made a function to set the width, according to the defined padding and border, and i think this should be also implemented in the core outherWidht function
my fucntion:
$.fn.extend({ setOuterWidth: function($value){ var elemento = $(this); var bordes = 0; bordes = bordes + parseInt( elemento.css('margin-left')); bordes = bordes + parseInt( elemento.css('margin-right')); bordes = bordes + parseInt( elemento.css('border-left-width')); bordes = bordes + parseInt( elemento.css('padding-left')); bordes = bordes + parseInt( elemento.css('padding-right')); bordes = bordes + parseInt( elemento.css('border-right-width')); $(this).css( 'width' , ( parseInt($value) - bordes) ); return this; } });
Change History (2)
comment:1 Changed 11 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
comment:2 Changed 11 years ago by
Note: See
TracTickets for help on using
tickets.
Duplicate of #10877.