DOM events/manipulation like slide()
won't have any effect on the view object's initialization because there is no such DOM element available yet.
Instead, you need to listen to dom:refresh
of the view to manipulate its DOM element.
So, just put the code in onDomRefresh
in your ItemView
onDomRefresh: function(){ $('#sliderContainer').slide() };
This above is a direct fix. But there are two more things to improve:
Don't call other div outside of this view when possible. In this case, if
#sliderContainer
belongs to another view, send an event to allow it slide itself. This is not the job of CategoryView. If it is inside current view, refer it withthis.$el.find(".some-div")
or better yetui
object.Your collectionView's appendHtml is unnecessary. Marionette also takes of this common case.