I have a bit of jQuery that I wrote for a fancy little here state. I want to take the code that I wrote, and implement it into the new AngularJS site that I'm making. I'm just not really sure where to start.
I think the best thing would be to make a Directive, but it needs to be triggered on click.
The JS:
var moveHereState = function(oldPos) {
var oldPos = oldPos;
var newPos = $('.active').position();
if(newPos.left < oldPos.left) {
$('.here-state').css("-webkit-transform", "scaleX( 1)");
} else {
$('.here-state').css("-webkit-transform", "scaleX( -1)");
}
newPos = newPos.left +"px";
$('.here-state').css('left', newPos);
};
$('a').on('click', function() {
var oldPos = $('.active').position();
$('.active').removeClass('active');
$(this).addClass('active');
moveHereState(oldPos);
});
moveHereState($('.active').position());
You can see this in action here: http://codepen.io/Pink401k/pen/sxljF?editors=001
Thanks for the help!