Giter Club home page Giter Club logo

jquery-scrollspy's People

Contributors

eithanshavit avatar mithgol avatar thesmart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jquery-scrollspy's Issues

Example file inclusion fix

You have a boo-boo in the example file.

You need to change:

    <script src="../scroll-spy.js"></script>

to:

    <script src="../scrollspy.js"></script>

Not a big deal. Any good developer can detect and fix this on his own.

scrollSpy triggers even when the element is not within the viewport

Hi
I am using the following html:

`

` and css: ` #section1, #section2 { height: 100%; width: 100%; } `

and using the scrollSpy plugin as follows:
`
$('#section2').on('scrollSpy:enter', function() {
alert("scrolled in");
});

$('#section2').on('scrollSpy:exit', function() {
              alert("scrolled out");
});

$('#section2').scrollSpy();

`

When the page loads, even though #section2 is not visible the alert is shown by the browser. How can I avoid this?
Also, if increase the height to 101% this issue is not occuring.

jQuery Mobile page navigation stops scrollspy

I am developing a jQuery Mobile 1.4 multi-page mobile app, also using ScrollSpy. It lists items on a page, and when it is (supposedly) seen by the user, it pings a server. You can click on the list item to go to a detail view page. When I navigate back to the list view, ScrollSpy doesn't spy any more.

As a fix, I had to add this to the scrollspy source code:

    $.clearScrollSpy = function()
    {
        jWindow = $( window );
        elements = [];
        elementsInView = [];
        isSpying = false;
        ticks = 0;
        offset = {
            top : 0,
            right : 0,
            bottom : 0,
            left : 0,
        };

        return this;
    };

It sets the object properties to their default values. Then call it like this after navigating back to the list view page: $.clearScrollSpy().scrollSpy( '.coupon_tracker' ); . I use the class "coupon_tracker" to identify HTML elements to be tracked.

Add event for centre of view

Hi - great lib nice that materialize have started to use it. So I found you as I wanted an event for when the item is in the middle of the viewport. It almost feels faster to do it myself but would prefer to levarage and already in use lib ..thanks

Adjusting offset

Is there a way to set an offset of the element before/after entering the screen?

I am having trouble with spying on elements which are shorter than the window height and the next element enters - then the next element takes precendence over the element that was already in screen and didn't exit

Doesn't update if the page is already scrolled onload

By default, Google Chrome remembers your scrolling position when you reload the page. When using this plugin to create a fixed navbar, this causes some issues: the page loads at a point where the navbar should be visible, but it isn't.

Is there a way around this? Thanks.

Support for div `overflow-y: scroll;`

thanks for this great plugin. I just tested it, but unfortunately it doesn't work on content which is within a div with style overflow-y: scroll; maybe because the viewport sit's on window? any idea how to get this working??

Fix sizzle selector error when using jQuery 2.2.0

The lines of code using attribute selectors to match the id do not work with the latest jQuery:

$('a[href=#' + visible[0].attr('id') + ']')

In my case, the error thrown is:
Error: Syntax error, unrecognized expression: a[href=#objective]

Simply changing the code to match the following correctly using " fixes this:

$('a[href="#' + visible[0].attr('id') + '"]')

I am happy to raise a PR to fix this as I feel it is quite important to address since Materialise CSS uses your plugin.

Error with installing the package as a repository using npm

@thesmart I have added this package to my package.json file

"dependencies": {
  ...
  "jquery-scrollspy": "https://github.com/thesmart/jquery-scrollspy.git"
  ...
}

when I run npm install there is an error npm ERR! premature close and this error because the package doesn't have a package.json file name, would you please add it ?

Incompatible with Scroll-To Functionality

Hi there. I'm using both scroll-to functions and scrollSpy in a current project, and have noticed they are of course incompatible.

Because scrollSpy listens to window scroll, and scroll-to anchors cause the window to scroll, weird jumping happens, etc. I'm aware there's a throttle, and keeping scrolls well within the throttle interval has prevent most weird stuff, but there are still edge cases that cause weird effects.

Is there currently a way to stop scrollSpy from listening for a set period of time? Would be really useful to be able to setTimeout some var to stop scrollSpy listening while scroll-to stuff is happening.

Eg:

scrollSpyWatching = false;
setTimeout(function() { scrollSpyWatching = true}, 500);

Using .on("scrollSpy:enter"), does not detect all spied elements

I'm using the jquery.on method with the scrollSpy:enter/:exit event, and the plugin is not detecting all of the divs I have it looking for.

I have the plugin looking for divs with specific classes, then applying a class to an SVG dot navigator to show the current section scrolled to. The functionality is a bit finicky, with sections not properly being detected, classes not being applied, etc. I have checked my code and it works fine, but the issue is that it's hooked on to the custom event.

Option for custom sized viewport rectangle for detecting elements

The entire viewport of the browser is currently used as the field; elements that enter this area have "entered" to use the terminology of this library.

I'm in need of offsets here - I would like to say that elements only enter when they've been scrolled half way up the viewport. This is not possible with the current design of code, and would probably need a bit of refactoring.

Preferably this would be something you could define in the options when calling the scrollSpy() method.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.