I have been having trouble getting this plugin to attach correctly to ajax loaded elements, and I haven’t been able to figure out the reason they sometimes get attached, and sometimes don’t. but only for this particular plugin. So my question is, would having a setInterval run something like every 300 milliseconds, or so cause the browser to become sluggish over time if it’s just attaching a jquery plugin to certain elements that may or not be on the page.
like:
setInterval(function(){
$(".nano").nanoScroller();
}, 300);
what I have initially tried doing is:
$.ajax({
type: "POST",
url: "ajax/load/notifications/notifications.php",
cache: false,
success: function(html){
$(".notification-container").html(html);
$(".nano").nanoScroller();
}
});
however it’s not attaching it (all the way anyways, some parts are being changed, but not the main plugin)
However, when I call another ajax event, and trigger the same thing in that callout, it attaches it to this element, and the other element.
The setInterval function adds it to them all as well.
It is inefficient to not cache the jQuery object and cause a DOM search for it every 300ms.
Call function after ajax also