【问题标题】:On Scroll Animate/SlideUp divOn Scroll Animate/SlideUp div
【发布时间】:2013-02-04 16:41:36
【问题描述】:

大家好,我整天都在谷歌上搜索,但找不到如何实现它的答案。滚动后,我希望屏幕底部的 div 位置向上滑动到该站点:

http://www.chanel.com/en_SG/。谢谢你的帮助。

【问题讨论】:

    标签: jquery html scroll scrollto


    【解决方案1】:

    这可以通过一些 jQuery 来完成。

    以下是一些您可以使用的基本示例:(http://jsfiddle.net/ujmMk/5/)

    $(function(){
        $(window).scroll(function(){ //onscroll
            var scrolleddown = false;//used to keep the state
            if($(window).scrollTop() > 1){ //if they've scrolled down
                if(scrolleddown == false){
                    scrolleddown = true;
                    $('#content').stop(true, false).animate({top:'0%'},500,function(){//show it
                        $('#topcontent').hide();//hide to original content, in this case "hi!"'s
                        $(this).css("position","relative"); //make it be able to scroll down
                    });
                }
            }else{
                //below resets everything back to original state when user scrolls back up
                scrolleddown = false;
                $('#topcontent').show();
                    $('#content').css("position","fixed").stop(true, false).animate({top:'99%'},500)
            }
        });
    });
    

    【讨论】:

      猜你喜欢
      • 2015-06-10
      • 1970-01-01
      • 2019-11-23
      • 1970-01-01
      • 2013-09-08
      • 1970-01-01
      • 2012-11-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多