Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript CSS animation interferes with Javascript? Reply To: CSS animation interferes with Javascript?

#196768
Shikkediel
Participant

Out of interest, is it possible to move the text with a top or bottom value as well as the opacity?

Certainly, very generally speaking it would look something like this :

$(window).on('load', function() {

$(this).scroll(function() {

var position = // some offset calculation
var dimness = 1-(($(this).scrollTop())/200);

$('.inner').css({'top': position, 'opacity' : dimness});          
});
});

Only if it has a position value of something other than static.

Note how the actual window onload trigger was added – currently everything would run on document ready which is a step before it (all files have been read but the window is yet to fully load).