Skip to content Skip to sidebar Skip to footer

How To Use Css3 Transition To Customize Page Scrolling

I'm looking for a way to use CSS3 Transition to create a smooth page scrolling. I know how to do it using javascript but if there's a way to do it with CSS3, i will prefer it for p

Solution 1:

You cannot control the scroll behavior with css. CSS3 transitions enable you to specify the way an element will go from an state to another, scrolling is a browser function not accessible to CSS.

Solution 2:

You can use transform: translate(x,y) to simulate "scrolling", and this can be animated using transitions via transition-property: all; Note, you will have to add the appropriate vendor prefix, as with much of CSS3 at the moment.

References: Mozilla Dev Center: transform, Mozilla Dev Center: CSS Transitions

P.S. use percentages carefully with transform: translate() -- depending on how your element is wrapped, -100% can mean next 'display-height' section of content

Post a Comment for "How To Use Css3 Transition To Customize Page Scrolling"