Tomkay
Tomkay

Reputation: 5160

JQuery (Javascript) CSS Value & Operator

I need to get the CSS value Width of a DIV-Container. Then I will divide this width value through 245px.

Pseudo Code:

var articles = "#showroom ul" css width / 245px

Upvotes: 1

Views: 316

Answers (3)

Betard Fooser
Betard Fooser

Reputation: 526

Depending on your specific needs, its worth mentioning the outerWidth() function. As it will return the width of the element, along with left and right padding, border, and optionally margin, in pixels.

http://api.jquery.com/outerWidth/

Upvotes: 0

Guerilla
Guerilla

Reputation: 80

for more specific dimensions see the dimension-functions in the jQuery manual

.outerWidth() and .outerWidth(true) are usefull in particular for elements with margins and borders

Upvotes: 0

Aistina
Aistina

Reputation: 12683

You'll want to use the width function:

var articles = $('#showroom ul').width() / 245;

jQuery width() function.

Upvotes: 5

Related Questions