Add and remove class at the setupContoller


#1

Hello everyone,

i have a Question… i try to remove and add a class from a element if the window-width has a specific width… but it doesn’t work… i am helpless… i try this code:

App.IndexRoute = App.AuthenticatedRoute.extend({
  setupController: function(controller) {
    controller.set('title', "Lobby");
    $('#lobby-head').removeClass('game');
    
    var width = $(window).width();
    if (width >= 851) {
        //alert('hallo?');
        $('.lobby-footer .send-gift li').removeClass('right').addClass('left');
        $('.lobby-footer .send-gift a').removeClass('btn-right').addClass('left');
    }
  }
});

Until the alert it works fine but then… nothing changes… anyone an idea?

nice regards Aviana


#2

ah i found it… fail… at this point the elements are not there/loaded…but the elements will build on “Lobby”… where is the point where they are finished loaded? know it anyone?