The jquery code I have for a tile-resize (like Metro tiles) menu is shown below:
$( document ).ready(function() {
$(".tile").height($("#tile1").width());
$(".carousel").height($("#tile1").width());
$(".item").height($("#tile1").width());
$(window).resize(function() {
if(this.resizeTO) clearTimeout(this.resizeTO);
this.resizeTO = setTimeout(function() {
$(this).trigger('resizeEnd');
}, 10);
});
$(window).bind('resizeEnd', function() {
$(".tile").height($("#tile1").width());
$(".carousel").height($("#tile1").width());
$(".item").height($("#tile1").width());
});
});
The question is; how would I go about converting this to an Angular 1.3 Directive. Is there a pattern for this sort of thing?