Forum Moderators: open

Message Too Old, No Replies

Angular Directive

Trying to get a starting point

         

Hornist

3:04 pm on Mar 14, 2016 (gmt 0)

10+ Year Member



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?

Fotiman

6:45 pm on Mar 14, 2016 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You might want to start with this:
[docs.angularjs.org...]

Hornist

8:35 pm on Mar 14, 2016 (gmt 0)

10+ Year Member



BEEN THERE DONE THAT. It's still not clear. I can't be the first person out there to ask for stub code on something like this...