null

Overview

ScrollUp Build Status devDependency Status

A jQuery plugin to create a customisable 'Scroll to top' feature that will work with any website

Installing with Bower

To install scrollUp with Bower:

bower install scrollup

How to use

Simply include the jquery.scrollUp.min.js file and place the following in the head of your document (make sure jQuery is included):

Minimum setup

$(function () {
    $.scrollUp();
});

Example with default options

$(function () {
    $.scrollUp({
        scrollName: 'scrollUp',      // Element ID
        scrollDistance: 300,         // Distance from top/bottom before showing element (px)
        scrollFrom: 'top',           // 'top' or 'bottom'
        scrollSpeed: 300,            // Speed back to top (ms)
        easingType: 'linear',        // Scroll to top easing (see http://easings.net/)
        animation: 'fade',           // Fade, slide, none
        animationSpeed: 200,         // Animation speed (ms)
        scrollTrigger: false,        // Set a custom triggering element. Can be an HTML string or jQuery object
        scrollTarget: false,         // Set a custom target element for scrolling to. Can be element or number
        scrollText: 'Scroll to top', // Text for element, can contain HTML
        scrollTitle: false,          // Set a custom <a> title if required.
        scrollImg: false,            // Set true to use image
        activeOverlay: false,        // Set CSS color to display scrollUp active point, e.g '#00FFFF'
        zIndex: 2147483647           // Z-Index for the overlay
    });
});

activeOverlay

To create a visible line to help determine an ideal scroll distance from the top, assign a valid CSS colour to the activeOverlay setting. This could be HEX, HSLA or RGB(A). Example: activeOverlay: '#00FFFF'. See the demo for an example.

scrollFrom

New feature in v2.0.0. Display the scrollUp element either the set distance from the top (default), or from the bottom of the page.

Destroy method

New feature in v2.0.0. If you need to destroy the instance of scrollUp, simple use the following to remove all modifications to the DOM:

$.scrollUp.destroy();

Fully Customizable

ScrollUp is fully customisable via CSS which makes it simple to fit right into your project. Simply target the scrollUp's generated ID in your CSS file and set your styles. Below is a basic style example:

#scrollUp {
    bottom: 20px;
    right: 20px;
    padding: 10px 20px;
    background-color: #555;
    color: #fff;
}

Use background image

To use a background image instead of text, simply set scrollImg: true. This will allow you to set a background image in your CSS file.

Contributing

Please see CONTRIBUTE.md for info on contributing.

Demo

Check out the demo for more style and feature examples.

Comments
  • Added Destroy Method.

    Added Destroy Method.

    Hi Mark,

    Your plugin, scrollup, is excellent. Thank you for your hard work. I hope you would consider integrating this change. Please let me explain what it is.

    I had the need to destroy this plugin properly. This was driven from the following scenario: I have a Light Box plugin that occupies the full screen, but when it is launched from the bottom of a page. The scrollup plugin produces a button with a z-index high enough to put it ontop of my light box. My solution was to add two events to the light box. One that executes when it is created, the other, when it is destroyed. I then attach a listeners to the lightbox that destroys or creates the scrollup appropriately. I would have added a qunit test, but there is none in the project. I compressed the file with nodejs uglify and added the change to the change log. I had considered changing the zindex, but that wouldn't have helped anyone else.

    Best regards, Philip A Senger

    opened by psenger 22
  • jQuery Dependency 1.10.2

    jQuery Dependency 1.10.2

    Thanks for the excellent plugin.

    Does scrollup really have a fixed dependency on jQuery 1.10.2? I've installed scrollup via bower and am using jQuery ~2.1.1 on the project and bower is forcing us to choose between meeting the scrollup dependency, and our desire to use a later version of jQuery. Are we missing something? Or is there any chance you could semver this to a higher version of jQuery?

    opened by 58bits 10
  • Easing Implementation

    Easing Implementation

    Greetings,

    Very nice plugin, I'll be using it for my site!

    I added a jQuery Easing option for the scrollUp function, e.g.,

    $.scrollUp({
      topSpeed: 600,
      easingType: 'easeInCirc'
    });
    

    It was just something I desired so I thought I'd share in case you'd like to implement.

    I also noticed some spelling errors in your README so I fixed those as well.

    Regards, Allyson

    opened by allybee 8
  • stripes after scroll up and down

    stripes after scroll up and down

    Hi everyone,

    Thank you Mark for your work! I have a little problem. Only in Safari this error is displayed while you scroll up and down. I took a picture of it and have attached it.

    Thanks for your help. stripes

    opened by TimGr 6
  • ScrollUp Anchor Titles

    ScrollUp Anchor Titles

    screen shot 2013-07-13 at 00 48 21 Leave anchor title for ScrollUp as scrollText by default, but allow it to be changed in instances where anchor title and scrollText should be different, for instance when using &uarr; symbol (↑) as scrollText a separate title is needed otherwise it reads as '&uarr;'.

    opened by domenicomazza 5
  • Support custom animations

    Support custom animations

    Hello, I'm using your plugin and it's fantastic. However, I miss an important feature for me: the ability to use custom animations for showing/hiding the button. I see in the README that the animation option has three possible values: none, fade and slide. It would be really cool if user could set any animation he wants, or maybe have an option that adds a class when the button is showed so that I can use the CSS3 transitions directly from the style.

    Added in v3 branch 
    opened by ste93cry 4
  • Add a new stopFromEnd option

    Add a new stopFromEnd option

    I just needed to add this for my project and I think it is a worthy addition. It allows adding an offset to stop the "back to top" button a certain distance from the bottom. This is useful if the site has a footer.

    The best I could come up with for the name was "stopFromEnd" but Im happy to take suggestions.

    opened by gr-eg 3
  • scrollup crashing some sliders

    scrollup crashing some sliders

    Hi, I am using scrollup and it was working fine with some sliders (bx slider, or owl slider). However when I try to use responsiveslides.js or unslider, they do not work when srollup.js is included. When I remove the line of code that includes the scrollup.js, the sliders are working properly. Would be nice if you could have a look on it and tell me how to make it work.

    opened by bhouszka 3
  • Often takes two taps to trigger scrollUp on Mobile Safari

    Often takes two taps to trigger scrollUp on Mobile Safari

    More than 50% of the time when using Mobile Safari (on my iPhone 5 or the iOS Simulator (both iOS7)) when I tap on the #scrollUp link, the page does not immediately scroll up but the address bar and bottom button bar pop back in to view (if they were hidden due to scrolling down the page). If I tap the #scrollUp link again once the address bar and bottom button bar are visible (or after scrolling back up a little manually to have them reappear), it will properly scroll to the top.

    Reproducible on http://markgoodyear.com/labs/scrollup/?theme=image.

    opened by jeffbowen 3
  • add scrollTrigger option. Allow user to provide her own triggering eleme...

    add scrollTrigger option. Allow user to provide her own triggering eleme...

    This feature allows users to pass a custom triggering element to scrollUp.

    It's a feature I needed for a project I'm working on.

    Example Usage: (use a FontAwesome glyph as link icon)

    $(function () {
      var scrollName = 'scrollUp'
        , scrollText = 'Scroll to top'
        , $icon = $('<i class="fa fa-arrow-up"/>')
        , $template = $('<a/>', {
            id: scrollName,
            href: '#top',
            title: scrollText,
          }).append($icon)
      ;
    
      $.scrollUp({
        scrollName: scrollName, // Element ID
        topDistance: '300', // Distance from top before showing element (px)
        topSpeed: 300, // Speed back to top (ms)
        animation: 'slide', // Fade, slide, none
        animationInSpeed: 200, // Animation in speed (ms)
        animationOutSpeed: 200, // Animation out speed (ms)
        scrollTrigger: $template, // Custom triggering element
        scrollImg: true,
        scrollText: scrollText, // Text for element
        activeOverlay: false, // Set CSS color to display scrollUp active point, e.g '#00FFFF'
      });
    });
    
    opened by freality 3
  • Tab moves in Firefox

    Tab moves in Firefox

    I noticed today when testing my site in Firefox, that the Tab style moves over when you hover on it. Kinda weird... I tried adding !important after the left:30px, but no luck. Your demo does it too.

    After you scroll back up, as its sliding back down it moves back to the left to the correct position. If you look at it in FF, you'll see what I'm talking about.

    Thanks a lot, love your plugin!

    bug 
    opened by megaroeny 3
  • Add: accessibility scroll up

    Add: accessibility scroll up

    With the developing technologies, for some of our friends in special situations, accessible applications are given importance in the world we live in. An edit proposal for this. It also removes the warning for Lighthouse.

    opened by fahrim 0
  • Uncaught TypeError: $.scrollUp is not a function with jQuery 3 and NPM

    Uncaught TypeError: $.scrollUp is not a function with jQuery 3 and NPM

    Doesn't seem to be working if installed via NPM and using jQuery 3. Any thoughts on a possible fix? I know .unbind() has been deprecated but changing it to .off() didn't fix it.

    Thanks! Danny

    opened by dlewand691 0
  • Remove deprecation showing up in conjunction with jquery.migrate

    Remove deprecation showing up in conjunction with jquery.migrate

    • remove deprecation showing up in conjunction with jquery.migrate JQMIGRATE: jQuery.fn.scroll() event shorthand is deprecated, jQuery.fn.click() event shorthand is deprecated
    • version to 2.4.2

    Using jquery migrate to discover some potentially warning/deprecation in my project i found some deprecation message in scrollup project... and i fix it. After fix the deprecation's messages are no longer displayed

    opened by fefoweb 0
  • bower data problem

    bower data problem

    bower scrollup#~2.4.1          extract archive.tar.gz
    bower scrollup#~2.4.1     invalid-meta for:/tmp/btervu/bower/b7edba58292def766c17063714a66af5-14031-esg8sh/bower.json
    bower scrollup#~2.4.1     invalid-meta The "main" field cannot contain minified files
    bower scrollup#~2.4.1         resolved https://github.com/markgoodyear/scrollup.git#2.4.1
    

    Could you fix it?

    opened by szepeviktor 0
  • Multiple instances possible?

    Multiple instances possible?

    Is it possible to, or how can I, initiate 2 instances? I need one at the bottom right for "Back to Top" and one at the top right for "Contact Us".

    Thoughts?

    opened by dlewand691 0
Releases(v2.4.1)
null

ScrollUp A jQuery plugin to create a customisable 'Scroll to top' feature that will work with any website Installing with Bower To install scrollUp wi

Mark Goodyear 995 Jan 2, 2023
An idiomatic way to enforce values not to be null nor undefined, with first-class support for TypeScript

nullthrows An idiomatic way to enforce values not to be null or undefined, with first-class support for TypeScript. Very lightweight with no dependenc

Expo 4 Jul 23, 2022