javascript - Carousel breaking on initial redirect, but works properly on refresh -
i have nav bar 'about' link. when clicked should bring subnav , redirect 'about.philosophy' rather 'about.index', does.
i have carousel partial i'm rendering on about.hbs template:
<div class="row about-bg"> {{partial 'about/about-carousel'}} </div> {{outlet}}
that being fired in aboutview:
ew.aboutview = ember.view.extend({ didinsertelement : function(){ $(window).load(function() { $("#about-carousel").caroufredsel({ responsive: true, width: "100%", height: 'variable', items: { height: 'variable' } }); }); } });
however, when 'about' link first clicked, changing url '/about/philosophy', carousel broken -- images stacked on top of 1 , no movement -- js isn't being found or something. hit refresh on browser carousel renders fine. must redirect breaking it, because works fine on refresh when ember isn't firing redirect.
the redirect function, along subnav rendering code in aboutindexroute:
ew.aboutindexroute = ember.route.extend({ activate: function(){ this.controllerfor('application').set('renderaboutsubnav', true); }, deactivate: function(){ this.controllerfor('application').set('renderaboutsubnav', false); }, redirect: function(){ this.transitionto('about.philosophy'); } });
the subnav failing display.
thanks much!
remove $(window).load(function() {});
wrapper didinsertelement
method.
Comments
Post a Comment