Convert jquery scroll event animation to css

0 votes
asked Oct 29, 2015 in Others by user5

How would I go about altering this code:

$(window).scroll(function(i){
var scrollVar = $(window).scrollTop();
$('section#about .inner').children('h2').css({'top': .7*scrollVar });
$('section#about .inner').children('h2').css({'opacity':( 100-scrollVar )/100});
})

to an add/remove class in order to use css3 animation? The jQuery animation is really janky. Thanks for any insigh

1 Answer

0 votes
answered Oct 29, 2015 by Admin (1,860 points)
 
Best answer
If you want to align the image, you just have to calculate the position according to its size.

ctx.drawImage(img, c.width - img.width/2, c.height - img.height/2,c.width/2, c.height/2);

In the example above, the image is aligned to bottom right corner. Btw, I divided it by 2, so you can clearly see the alignment.
commented Oct 29, 2015 by User 5
Thank you for the help Asdmin
Welcome to I Can Crack, where you can ask questions and receive answers from other members of the community.

68 questions

47 answers

3 comments

5,318 users

...