I'm trying to activate a resize event on the following function:
$(function() {
if (Modernizr.mq('only screen and (min-width: 1140px)')) {
$('div#ss1').html('<div>[snip]</div>');
$('div#ss1').append('<div><gcse:searchbox-only></gcse:searchbox-only></div>');
}
if (Modernizr.mq('only screen and (max-width: 1139px)')) {
$('div#ss2').html('<div>[snip]</div>');
$('div#ss2').append('<div><gcse:searchbox-only></gcse:searchbox-only></div>');
}
});
I wanted to add a resize listener to it. Based on http://api.jquery.com/resize/ I changed the first line to $(window).resize(function()
but then the whole function stopped working.
What am I doing wrong? Thanks.
UPDATE: Based on this Paul Irish post I added smartresize to my plugins.js. I changed the function call from $(function()
to $(window).smartresize(function()
and it stopped working. Changing it back to $(function()
and it worked again. Why can't I add a resize event listener of any type to this sucker? :-)