javascript - How to scroll down when hover an image? -


i want when hovering image, scroll down end of image.

i have 2 question:

  1. how scroll end of image when user hover on it? currently, start hover on image, wasn't scrolled end of image.

  2. how control speed of scroll when hovering on image?

my code:

body {    margin: 2px auto;    width: 500px;  }    .pic {    width: 48%;    height: 200px;    overflow: hidden;    margin: 0 auto;    display: inline-block;    position: relative;    cursor: pointer;  }    .pic:before {    width: 100%;    height: 200px;    background: rgba(0, 0, 0, 0.5);    position: absolute;    top: 0;  }    .pic:after {    color: #fff;    font-size: 18px;    position: absolute;    top: 50%;    left: 50%;    margin: -20px -25px;    border: 1px solid rgba(255, 255, 255, 0.5);    padding: 10px;  }    img {    max-width: 100%;    cusor: pointer;  }    .pic:hover img {    animation: moveslideshow 3s linear;  }    @keyframes moveslideshow {    100% {      transform: translatey(-60%);    }  }    .pic:hover .pic:after {    opacity: 0;  }
<div class="pic"><img src="http://scr.templatemonster.com/51600/51651-big.jpg" alt="" /></div>      <div class="pic"><img src="http://www.cssauthor.com/wp-content/uploads/2014/06/good-to-go-single-page-psd-template1.jpg" alt="" /></div>

this works fine. added calc width of image, height of div minused , scrolls bottom of div only.

css:

.pic:hover img {   animation: moveslideshow 3s linear;   animation-fill-mode: forwards; } 

jsfiddle: here


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -