开发者

How to do the TEXT fade-in effect upon scroll down

I need a small help on loading Text With FADE-IN effect upon scroll down. I found a plug-in for loading fade in eff开发者_运维问答ect for Images ( like Mashable.com ), but i am requiring same for TEXT.

Thank You


Like @動靜能量 said, one part of your solution is using the fadeIn method.
The other part is writing the code into $(window).scroll(function (e) {})

Check out the scroll api http://api.jquery.com/scroll/

And you might also want to use this:

(function ($) {
    jQuery.fn.scrollOffset = function () {
        var win = $(window);
        var topSpace = this.offset().top - win.scrollTop();
        var bottomSpace = win.height() - this.height() - topSpace;
        var leftSpace = this.offset().left;
        var rightSpace = win.width() - this.width() - leftSpace;
        return { top: topSpace, bottom: bottomSpace, left: leftSpace, right: rightSpace };
    };
})(jQuery);

This gets the scroll offset of a certain element.

Hook it all together and you should be able to come up with a solution.


you don't need any plugin to fade in text. You can just use jQuery's fadeIn()... something like

$('#my-div').fadeIn();

to fade in a div with id="my-div". http://api.jquery.com/fadeIn/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜