Answer the question
In order to leave comments, you need to log in
Who knows how to make an object move horizontally when scrolling?
and so there is the code
<div id="axis" class="one">
<img class="object van move-right" src="images/van-to-right.png" alt="" /></div>
.object {
position: absolute;
transition: all 2s ease-in-out;
-webkit-transition: all 2s ease-in-out; /** Chrome & Safari **/
-moz-transition: all 2s ease-in-out; /** Firefox **/
-o-transition: all 2s ease-in-out; /** Opera **/
}
.van {
top: 45%;
left: 44%;
}
#axis:hover .move-right{
transform: translate(350px,0);
-webkit-transform: translate(350px,0); /** Chrome & Safari **/
-o-transform: translate(350px,0); /** Opera **/
-moz-transform: translate(350px,0); /** Firefox **/
}
Answer the question
In order to leave comments, you need to log in
How to add and remove a class on call?
For a place hover - class.
#axis.transform .move-right{
transform: translate(350px,0);
}
I tried this using jQuery
function checkScroll() {
$(*id элемента*).each(function() {
var topEdge = $(this).offset().top,
bottomEdge = topEdge + $(this).height(),
wScroll = $(window).scrollTop();
if(topEdge < wScroll && bottomEdge > wScroll) {
*делаем смещение путем добавления нужного класса CSS*
}
});
};
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question