Reputation: 1937
I am creating elements using:
$(sel).append("html");
I need to apply the dotdotdot plugin to this dynamically created html (which has the class "ellipsis"), but it doesn't seem to go into effect.
$(document).ready(function() {
$(".ellipsis").dotdotdot({
ellipsis : '... ',
watch: "window"
});
});
How do I apply the plugin to dynamically created html?
EDIT:
This is working now, but I have another problem. I can see the element's text overflow before dotdodtdot is applied for dynamically created elements. Is there a way to fix this?
Trying to remove "visibility: hidden;" after it its loaded in the callback, but it also does not seem to work:
/*css*/
.invisible {
visibility: hidden;
}
//js
$(".ellipsis").dotdotdot({
ellipsis : '... ',
watch: "window",
callback: function() { $(".ellipsis").removeClass("invisible"); }
});
Upvotes: 1
Views: 343