Bind an event handler to the "resize" JavaScript event, or trigger that event on an element.

Put the follow source into your files

1
2
3
4
5
6
7
8
9
10
11
12
13
$(window).resize(function() {
    if(this.resizeTO) clearTimeout(this.resizeTO);
    this.resizeTO = setTimeout(function() {
        $(this).trigger('resizeEnd');
    }, 500);
});

$(window).bind('resizeEnd', function() {
//get the current width
console.log($(this).width());
//get the current height
console.log($(this).height());
});