Soulremedy Soulremedy - 1 year ago 149
Javascript Question

Jquery/Javascript Opacity animation with scroll

I'm looking to change the opacity on an object (and have the transition be animated) based on a users scroll.

I've searched everywhere
like here, but it ends up pointing me to the waypoints plugin (

I've implemented the [waypoints][1] plugin and have the object fading once it's higher than 100px. [Using the offet attribute] but would like to basically control the opacity of an object and have the animation be visible like the above example.

I've searched all over- this is my last resort.
Any help is greatly appreciated.

Answer Source

working exemple with starting and ending point here:

I copy paste basic code here

    var fadeStart=100 // 100px scroll or less will equiv to 1 opacity
    ,fadeUntil=200 // 200px scroll or more will equiv to 0 opacity
    ,fading = $('#fading')

$(window).bind('scroll', function(){
    var offset = $(document).scrollTop()
    if( offset<=fadeStart ){
    }else if( offset<=fadeUntil ){
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download