WordPress.org

Support

Support » Plugins and Hacks » Why use all this code (i've see in archive plugin) when u can simply use…

Why use all this code (i've see in archive plugin) when u can simply use…

  • 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/

Viewing 1 replies (of 1 total)
  • natesimpson
    Member

    @natesimpson

    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?

Viewing 1 replies (of 1 total)
  • The topic ‘Why use all this code (i've see in archive plugin) when u can simply use…’ is closed to new replies.