How do I register a JS function to run when a browser window is resized?
I assume it’s in the
Page.ClientScript
class methods somewhere, but I am a bit confused.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Resizing the browser window requires a client-side script, so it’s probably more appropriate to write this directly into .aspx page in a script block, or possibly in a .js file.
That being said, check out this question, you can use a script similar to this: JavaScript window resize event via the Page.ClientScript.RegisterStartupScript method.