Fahad Ur Rehman
Fahad Ur Rehman

Reputation: 348

Jquery Conditional Width of div

I am working in drupal. I have 2 floating div in 1 container div. The container width is 1000px which contains 2 floating divs col1 (width:700px) & col2(width:300px). In some pages I dont want col2 which is done through php condition in page.tpl.php

I need a way to rewrite the width of div id "col1" to 100% if there is no available in the document or container div.

Upvotes: 2

Views: 350

Answers (1)

ezmilhouse
ezmilhouse

Reputation: 9121

something like that?

if (!$("#col2").length) {
   $("#col1").css("width", "1000px");
}

Upvotes: 2

Related Questions