Jump to content
The ibi Community has moved to a new platform: Please Sign In and choose Forgot Password to continue

Is there a way to get this to work in the HTML composer $(d...


Les Johnson 3

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 2 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...