Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery resize() not work?

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>');
    });  
});
like image 381
Gelin Luo Avatar asked May 25 '26 05:05

Gelin Luo


1 Answers

"window" is not a selector; there is no <window> element.

You want $(window).

like image 59
SLaks Avatar answered May 27 '26 18:05

SLaks



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!