Bug Tracker

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#10994 closed enhancement (duplicate)

Extend the functionality of outherWidth to be able to set the objects width

Reported by: contact@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:


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:

	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 5 years ago by dmethvin

  • Resolution set to duplicate
  • Status changed from new to closed

comment:2 Changed 5 years ago by dmethvin

Duplicate of #10877.

Note: See TracTickets for help on using tickets.