JSFiddle - React, Tailwind, and code Playground
by siyegen
HTML
<body>
</body>
CSS
div {
color: blue;
}
JavaScript
$(function(){
console.log('ready');
(function() {
var ev = new $.Event('tri_append');
var orig = $.fn.append;
$.fn.append = function() {
orig.apply(this, arguments);
var ele = arguments[0];
var tag = $(ele)[0].tagName || "";
if (tag.toLowerCase() != 'img') {
$(this).trigger(ev, [arguments[0]]);
}
};
$('html').delegate('body', 'tri_append', function(e, y) {
var src = $(y).attr('src');
var ele = $('img[src="'+src+'"]');
console.log('triggered');
setTimeout(function() {
ele.mouseover();
ele.css('border', '1px solid black');
}, 10+parseInt(Math.random()*79));
});
})();
$('body').append("<img src='http://placehold.it/200x100&text=[moo%20img]' />");
$('body').append('<div>moo</div>');
$('img').on('mouseover', function(e) {
alert('over!!');
});
$('img').first().mouseover();
});