how to capture window resize event javascript?

Votes : 5
852
I want to add some style when window resizing in javascript. How to capture windows resize event?

Your Answer

1 Answer

answered
In javascript,
window.onresize = function(){
   console.log('this function will be triggered, when window resize.');
};
If you use jQuery library,
$(window).resize(function(){
     console.log('this function will be triggered, when window resize.');
});
//or 
$(window).bind('resize', function () {
     console.log('this function will be triggered, when window resize.');
}).trigger('resize'); 

What is the codrate ?

codrate.com is a standard, fast cross browsing and highly versatile site. It is useful for many large number of Program Development Industries. So you can get support form Codrators , who are the codrate's joiners around world to help your program developments, You can answer other codrator's questions. Communicate with them. Share your knowledge with them. Do you have an interest in programming, So publish your articles about programming. It will help to maintain your professional co-profile. Actually codrate.com is not such as a regular web site. It will be gave new experience, best narrow cross-browser view, reduce processing time to receive browsing request, it's mean do not wasting your time to browsing codrate's web pages because it has been upgrade always modern coding ways. So, what do you waiting for ?. Try your own.

Copyright 2015 Pride - Company. Design by Esila