Quân Ken Quân Ken - 4 months ago 6
Javascript Question

What the animated in this code ? I can't find any tip. Help me

http://e-web.vn/giao-dien/theme-wordpress-phu-kien-di-dong/

When hover in image i't scoll down. But i don't know what is this. Any help for me ?

Many Thanks !

Answer

Probably using something like:

$('#image').hover(function(){
    $('#image').animate({ scrollTop: $('#image')[0].scrollHeight }, 1000);
});‚Äč

EDIT:

You can actually do it in css. Here is an example: https://jsfiddle.net/7mxout0g/

Basically it uses a transition on :hover Documentation

.screen:hover div {
  background-position: center bottom;
  -webkit-transition: all 10s;
  -moz-transition: all 10s;
  -ms-transition: all 10s;
  -o-transition: all 10s;
  transition: all 10s;
}