WordPress.org

Ready to get started?Download WordPress

Forums

jQuery Smooth Scroll
Why use all this code (i've see in archive plugin) when u can simply use... (2 posts)

  1. DarkWolf
    Member
    Posted 1 year ago #

    This little bit code? :|
    <a href="#" class="scrollup">Scroll</a>

    .scrollup{
        width:40px;
        height:40px;
        opacity:0.3;
        position:fixed;
        bottom:50px;
        right:100px;
        display:none;
        text-indent:-9999px;
        background: url('icon_top.png') no-repeat;
    }

    ---

    <script type="text/javascript">
        $(document).ready(function(){
    
            $(window).scroll(function(){
                if ($(this).scrollTop() > 100) {
                    $('.scrollup').fadeIn();
                } else {
                    $('.scrollup').fadeOut();
                }
            });
    
            $('.scrollup').click(function(){
                $("html, body").animate({ scrollTop: 0 }, 600);
                return false;
            });
    
        });
    </script>

    Source + demo: http://gazpo.com/2012/02/scrolltop/

    http://wordpress.org/extend/plugins/jquery-smooth-scroll/

  2. natesimpson
    Member
    Posted 1 year ago #

    does this make all link and anchor points smooth scroll? If so then how do you set an offset for top margin... Say to leave room for fixed navigation and or header?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.