Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fixed blank problem with blank position() #1014

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
Loading
from

Conversation

JudeOsborn
Copy link

I noticed that when scrollable does not have a full complement of items (blank spaces) an error will be thrown when circular is turned on. I have adjusted for this error by returning an top value of 0 when there is no top value.

@alibby251
Copy link
Contributor

Hi JudeOsborn,

Any chance you could please provide a test case, where we can see a before (i.e. with the error) and after (without the error)? Also, could you please rebase this on the dev branch of jQuery Tools, and not the master as you have done here?

Thanks.

@JudeOsborn
Copy link
Author

Here's a JSFiddle that illustrates the problem:

http://jsfiddle.net/T5uvu/1/

You'll see that the problem only surfaces when setting "circular" to true. If you view the "result" frame's console you'll see the message "Uncaught TypeError: Cannot read property 'top' of null". I don't have a CDN version of my fixed version, but all I'm doing is handling a null position().

@Mairu
Copy link

Mairu commented Jun 18, 2013

If item.position() is null, the else part will throw the same error and so should also be modified to be correct when vertical is false.

@JudeOsborn
Copy link
Author

Yes, good point. I fixed that and simplified the line of code a tiny bit.

@Mairu
Copy link

Mairu commented Jun 19, 2013

But props should be an object: 0 != {top: 0} or {left: 0}, otherwise the animate call should fail or at least would do nothing.

var dir = vertical ? 'top' : 'left',
    props = {},
    pos = item.position();
props[dir] = pos ? -pos[dir] : 0;

If no animation is done when no position is available return self; would be best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.