I have the following simple code but it seem that not work.
jQuery(document).ready(
function($)
{
$(window).resize(
function()
{
setGrid($);
}
);
setGrid($);
}
);
function setGrid($)
{
var contactContainer = $('#contactInfo');
if(contactContainer.width() < 650)
{
console.log('Too short');
$('.col_1_2').css(
{
width : '100% !important',
margin : '0 !important'
}
);
}
else
{
console.log('Too long');
$('.col_1_2').css(
{
width : '49% !important',
marginRight : '1% !important'
}
);
$('.last').css(
{
width : '49% !important',
marginRight : '0 !important',
marginLeft : '1% !important'
}
);
}
}
So, when I resize the window I am getting both the messages in my Chrome console, according to the #containerInfo, but the .col_1_2 are not updated.
Is there anything wrong in my code and I cannot find it out ?
Note : I have my console open and I do not get any error message in my console. Also in the "Elements" tab of my console I am inspecting the element that must get modified, and I do not see any change. Normaly a "style" attribute should be added on the matched element.
Kind regards
$like that? Can't you do this in pure CSS with mediaqueries? I don't know, something doesn't look right, setting!importantin jQuery like that...