Reputation: 515
Looking for Angular animation to scroll div top and bottom on mouse over, on mouseout we should clear the scrolling.
Exactly similar kind of animation.
http://www.solucior.com/13-Scroll_div_with_javascript.html
function scrollDiv(divId, depl) {
var scroll_container = document.getElementById(divId);
scroll_container.scrollTop -= depl;
timer1 = setTimeout('scrollDiv("'+divId+'", '+depl+')', 30);
}
This is Java script code. But i am looking for Angular Code.
Upvotes: 0
Views: 1384
Reputation: 1844
Some of the steps are pretty basic Angular. I'm sure the community would appreciate it if you showed that you put some effort into finding the solution yourself. specifically, parts 1 and 3 are pretty basic. I'll give you the benefit of the doubt and assume that you gave it an effort and are still stumped :-)
onmouseover=
and onmouseout=
, you will use (mouseover)=
and (mouseout)=
, putting a function from the component's class after the =
. Learn more about event binding#someElementName
, and then when you call the function on a mouse event, pass someElementName
. Learn more about template reference variablestimer1
will become a class member of the component (this.timer1 = setTimout...
). Learn more about component basicsa stackblitz with the result
Upvotes: 2