Les Johnson 3 Posted June 17, 2020 Posted June 17, 2020 Is there a way to get this to work in the HTML composer $(document).ready(function(){ $(window).resize(function(){ // Do something // }); });
Les Johnson 3 Posted June 18, 2020 Author Posted June 18, 2020 Not getting an error, its just not executing the resize function.
Ricardo Ontiveros Posted June 24, 2020 Posted June 24, 2020 have you tried to put the resize function inside of the window_onload function that is included in the html composer embedded javascript tab something similiar like this: function window_onload(){ $(window).resize(function(){ alert(resize function); }); } Is probably that your piece of code is being executed before the jquery reference
Steven Hall Posted June 25, 2020 Posted June 25, 2020 Or a vanilla JavaScript version: //Begin function window_onload function window_onload() { //Below will add content to a blank html page that will show the width and height of the window as it is being resized var content = '<div id="wrapper" style="font-size:1rem;padding:0 10px 10px 10px;"><p>Resize the browser window to fire the <code style="background:#0002;padding:0 3px;border-radius:3px;">resize</code> event.</p><p><div>Window height: <span id="height"></span></div></p><p><div>Window width: <span id="width"></span></div></p></div>'; document.body.innerHTML = content; //This is what you need for the resize event window.onresize = function(){ // Add the code here that you want to execute when the window resizes. document.getElementById('height').textContent = this.innerHeight; document.getElementById('width').textContent = this.innerWidth; }; } //End function window_onload
Pawan Vuppala Posted July 7, 2020 Posted July 7, 2020 You could also throw it inside onInitialUpdate() function if you want.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now