Documentation Request #43
Comments
Hi there! So you're passing your variables in as if it's an object, when it should be passed in as a simple argument. You're also passing in your anchor variable where You'd want this: |
I should also mention, if you wanted to change things like easing or scroll speed, you'd additionally pass in the options object: var settings = { speed: 1000, easing: 'easeOutCubic' };
smoothScroll.animateScroll( null, '#bazinga', settings ); |
@dgoodale - Thanks for the suggestion on updating the docs. I just added a few examples, and will be doing so for my other scripts as well. Cheers! |
Thank you very much for getting back to me so quickly and helping. It's David Goodale From: Chris Ferdinandi [mailto:notifications@github.com] @dgoodale https://github.com/dgoodale - Thanks for the suggestion on Reply to this email directly or view |
Hi Chris, I tried to use the code suggestion you gave me and I'm still getting an I have the smooth scroll javascript loaded and working properly with a But I want to launch it from a javascript event. It's a really simple one.
choose a quantity of black chairs.
smoothscroll event. Here is the function: function dropdownChange() { alert('going to scroll'); smoothScroll.animateScroll( null, '#bazinga' ); } --- I know it works because the alert box that comes up and says "going to TypeError: toggle is null I have tried using it with settings, without settings. Something isn't Thanks Chris. From: Chris Ferdinandi [mailto:notifications@github.com] @dgoodale https://github.com/dgoodale - Thanks for the suggestion on Reply to this email directly or view |
I have a hunch what's going on here, and how to fix it. Not anything you're doing, but a bug in my code. Is FireFox giving you a line number that the error is occurring on? |
Hi Chris, No, but I checked in explorer using the developer tools and got this: SCRIPT5007: Unable to get property 'getAttribute' of undefined or null File: smooth-scroll.js, Line: 121, Column: 3 Thanks Chris, David Goodale From: Chris Ferdinandi [mailto:notifications@github.com] I have a hunch what's going on here, and how to fix it. Not anything you're Reply to this email directly or view |
Hi David - I just pushed version 4.2, which includes a fix for this bug. Thanks again for letting me know about it, and helping me work through it. Let me know if you have any other questions or issues. |
Would it be possible to update the documentation to include a working example of calling a smooth scroll event using javascript?
I have been trying to implement a fairly simple javascript function that fires when a drop down box is changed. When the user changes the drop down box, I want the page to smoothly scroll down to a predetermined anchor tag.
From within my javascript function I have tried using this:
smoothScroll.animateScroll(anchor: '#bazinga');
or
smoothScroll.animateScroll(anchor, '#bazinga');
or
smoothScroll.animateScroll('anchor: #bazinga');
I have tried several different ways and cannot get the syntax correct. I apologize if this problem is just due to the fact that I find javascript tricky. However, I think potentials users of the script could do with a few more demos.
Thank you, all the best.
The text was updated successfully, but these errors were encountered: