Skip to content
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

Cannot read property 'offsetTop' #7

Open
IB-VT opened this issue May 12, 2015 · 7 comments
Open

Cannot read property 'offsetTop' #7

IB-VT opened this issue May 12, 2015 · 7 comments

Comments

@IB-VT
Copy link

IB-VT commented May 12, 2015

I tried to use this fantastic plug-in and it works well, as long there is no navigation bar at the top of the site.

When using the bootstrap navigation bar, smartscroll generates the error "Cannot read property 'offsetTop'" on chrome or a "Die Eigenschaft "offsetTop" eines undefinierten oder Nullverweises kann nicht abgerufen werden." (property "offsetTop" of a undefined Null-reference could not be read) on IE.

Is it possible to set an offset for the page top ?

@d4nyll
Copy link
Owner

d4nyll commented May 13, 2015

Thanks for letting me know, do you think it'd be possible for you to host your site somewhere so I can directly debug from there?

@IB-VT
Copy link
Author

IB-VT commented May 13, 2015

Hi Daniel,

thanks for the fast reply, the site is online at: www.ib-barwich.de/test

I tried to figure out if there is any interacting with other scripts used by the site, but could not find the problem yet.

@d4nyll
Copy link
Owner

d4nyll commented May 14, 2015

I took a look at your markup.

Right now, the structure needs to be:

<div class="section-wrapper">
    <div class="section" data-hash="section-hash-name"></div>
    <div class="section" data-hash="section-hash-name"></div>
</div>

Where the section needs to be direct children of the container. Also, for the time being, there cannot be anything in between the sections (which is part of the 'Requirements' - There can only be one set of adjoining sections).

So you'd need to structure it that way.

Also for the time being, hybrid scroll doesn't work at the bottom #8, so you'd have to scrolljack down to the 'Contact' section. But I aim to fix this soon.

Please let me know if that's possible for you, and whether you're able to resolve the issue!

@maoosi
Copy link

maoosi commented May 21, 2015

I got the same problem using html5 tags structure.

Solved it by replacing css selector used on smartscroll.js, line 106:
replace :nth-of-type by :nth-child

@d4nyll is there any particular reason you used :nth-of-type ?

@d4nyll
Copy link
Owner

d4nyll commented Jun 13, 2015

@maoosi I used :nth-of-type because originally, I wanted to allow the users to have other things inside the section wrapper. But now I can change it to :nth-child, it'd be equivalent. Still I am curious why :nth-of-type didn't work...

@maoosi
Copy link

maoosi commented Jun 15, 2015

Because :nth-of-type selector is attached to a particular type, so if we don't want to use the same tag type (something different from a <div> like <section> or <article>, or even differents types inside the same parent element), it will not work anymore.

I think you can replace all your :nth-of-type by :nth-child everywhere it's used in your plugin in order to make it more flexible.

@d4nyll
Copy link
Owner

d4nyll commented Jun 15, 2015

@maoosi That's a very good point I didn't consider. I will update it in the next push! Thanks!

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

No branches or pull requests

3 participants