Reputation: 14373
This might be very stupid, but I am not sure where I am wrong. I found jQuery 'resize()' not work at all. Check this fiddle: http://jsfiddle.net/FefFW/1/
<div id="log"></div>
jQuery:
$(function(){
$('#log').append('<h3>event log</h3><hr/>');
$('window').resize(function(){
$('#log').append('<p>resizing...</p>');
});
});
Upvotes: 3
Views: 1103
Reputation: 318162
$(function(){
$('#log').append('<h3>event log</h3><hr/>');
$(window).on('resize', function(){
$('#log').append('<p>resizing...</p>');
});
});
Upvotes: 4
Reputation: 1475
Have you remembered to put it within
$(document).ready(function() { });
?
And yeah, like the rest just noted when watching the fiddle 'window'
is wrong.
Upvotes: -1
Reputation: 887205
"window"
is not a selector; there is no <window>
element.
You want $(window)
.
Upvotes: 6