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

I can't reactivate scrollify after use $.scrollify.destroy() #36

Closed
boatkung opened this issue Sep 4, 2015 · 8 comments
Closed

I can't reactivate scrollify after use $.scrollify.destroy() #36

boatkung opened this issue Sep 4, 2015 · 8 comments

Comments

@boatkung
Copy link

boatkung commented Sep 4, 2015

This is my code

var scrollifyOption = {
        section: '.frame',
        scrollSpeed: 400,
        afterResize: function() {
            if( $(window).width() < 768 ) {
                $.scrollify.destroy();
            }
        },
    }

    if( $(window).width() > 768 ) {
        $.scrollify(scrollifyOption);
    }

    $(window).resize( $.debounce('300', function() {
    if( $(window).width() > 768 ) {
        $.scrollify(scrollifyOption);
    }
}));

I also try this https://github.com/lukehaas/Scrollify/blob/master/jquery.scrollify.js from this post #32 and this is console from Chrome

console.log

@lukehaas
Copy link
Owner

lukehaas commented Sep 5, 2015

Thanks, I've just pushed a fix to jquery.scrollify.js that should resolve this.

@noinstance
Copy link

Same problem that I had. Your fix didn't work for me. See my pull request.

@zakgreene
Copy link

Hi, I was having the same issue, tried your fix and although it removed the JS error, it can't seem to scroll. The URL hash also changes to /#[object Object]. Tried using .move() to no avail.

@noinstance
Copy link

If you're using the minified version, don't, I didn't update it. The non minified version works for me. I'm calling $.scrollify({ params }) if the window width is bigger than a certain size. If it is resized down, i call $.scrollify.destroy() and $.scrollify({ params }) again if resized up.

@zakgreene
Copy link

I'm using the non-minified verison. When I recreate the $.scrollify instance after destroying it, I sometimes get an error Cannot read property 'height' of undefined. This only happens if I've scrolled down a bit when recreating the instance. In every case, the URL becomes /#[object Object].

@noinstance
Copy link

Maybe it's a different problem? I can't duplicate that. My urls look nice
too.

On Mon, Sep 7, 2015 at 7:23 PM, Zak Greene notifications@github.com wrote:

I'm using the non-minified verison. When I recreate the $.scrollify
instance after destroying it, I sometimes get an error Cannot read
property 'height' of undefined. This only happens if I've scrolled down a
bit when recreating the instance. In every case, the URL becomes /#[object
Object].


Reply to this email directly or view it on GitHub
#36 (comment).

@lukehaas
Copy link
Owner

lukehaas commented Sep 7, 2015

I realised what was wrong with the update I pushed. I've pushed another update that resolves both your problems.

@zakgreene
Copy link

This works great now, thank you @lukehaas! I'm still sometimes getting the error Cannot read property 'height' of undefined sometimes when I destroy(), but it doesn't affect anything on the site.

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

4 participants