Styles

For performance reasons, Karmagination will not be camel-casing the CSS properties. If you with to use these methods make sure to do them yourself, ie. zIndex (not z-index), backgroundColor (not background-color).

css( name )

Get the current value of the style for the first element.

<div style="color:red">a</div>
Karma('div').css('color'); // returns red

css( name, value )

Sets the current value of the style.

Karma('div').css('color', 'blue'); // makes div color blue

css( properties )

Sets a bunch of styles to the elements.

<div>Hello</div>
Karma('div').css({
  color: 'red',
  backgroundColor: 'blue'
});

height( )

Get the calculated height of the first element.

<div style="height: 10px">abc</div>
Karma('div').height(); // returns 10

height( val )

Set the inline CSS height to val on the selected elements.

<div>abc</div>
Karma('div').height('10px');
Karma('div').height(); // returns 10

width( )

Get the calculated width of the first element.

<div style="width: 10px">abc</div>
Karma('div').width(); // returns 10

width( val )

Set the inline CSS width to val on the selected elements.

<div>abc</div>
Karma('div').width('10px');
Karma('div').width(); // returns 10
 
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki