Skip to content

Instantly share code, notes, and snippets.

@joachimhs
Created August 30, 2012 14:27
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save joachimhs/3529609 to your computer and use it in GitHub Desktop.
Save joachimhs/3529609 to your computer and use it in GitHub Desktop.
Ember.js rerender on window resize issue
init: function() {
var view = this;
var resizeHandler = function() {
view.rerender();
};
this.set('resizeHandler', resizeHandler);
$(window).bind('resize', this.get('resizeHandler'));
},
willDestroy: function() {
$(window).unbind('resize', this.get('resizeHandler'));
}
@royalsflush
Copy link

Thanks, I was looking for a way to handle a resize in an organised fashion, so that's exactly what I wanted!

@RichardJohnn
Copy link

Cheers!

@samselikoff
Copy link

I think you need a this._super(); at the beginning of init here.

@maheshsenni
Copy link

Works like a charm after adding this._super();. Thanks @samselikoff for pointing it out.

@mark-henry
Copy link

@hoIIer
Copy link

hoIIer commented May 17, 2015

@mark-henry how could I use that run-bind to rerender any page in the app on window resize?

@0xcaff
Copy link

0xcaff commented Aug 10, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment