I am using Backbone View to render some widgets, and they are inserted into the DOM after being rendered as a standalone element. While some plugins/widgets work when the element is still 'in the mid air', others require the element to be part of DOM to function properly. For instance, in the backbone view's render method, I need to call:
$("#images").slimScroll(); //slimScroll is a jquery plugin that add custom scrollbar
But this doesn't work. It works only after the Backbone View element is in the DOM, now my workaround is to call the plugin method after inserting widget to DOM, but this is very inflexible. So I need an event when an element is rendered in the DOM, something like document.ready but triggered when the element is ready in document. Is there such an event? Or what is the best way to deal with such situation?