Would anyone know how to make external links smooth scroll as well. Say this my website is http://www.cyberfanatic.com/ right and so if i post a link like so http://www.cyberfanatic.com#footer can you make it so that when the page is done loading it will smooth scroll to the footer. Basically smooth scroll to external anchor links the code i use right now to enable smooth scroll on same page links is like so
I also use classes to smooth scrolling my blog from comment permalink's #hash to targeting the class (I change all commentID to class), not targeting the ID T_T
thing is that i don't just want this to go to the footer i want this to happen to every hash mark used as a bookmark on my website. So can you please help.
its that long of a js file so should only take 1 mintue to read all the code please tell me what i am doing wrong. as when i insert your code into my website all it does is take the hash away from the url and then jump to the anchor link
recheck that i finally got the code to work but the only problem is that it only works when i put a class on the anchor link can you please alter the code so i can do it with an id instead of putting the class on an anchor tag.
What i am saying is your above code only works when the anchor link is like this
see i think you are understand me wrong the code works fine but not under my circumstances. I took a look at your jsfiddle and saw that when you changed the script you also changed the section. at first you had the class set to section1 now you have the href to section one. I don't want the href and nor do i want the class. I want something like this
<a id="#comehere" href="#">On page Load come to this id</a>
Any help would be much appreciated. So on page load it will to the anchor link #comehere
http://codepen.io/pen/tovic/smooth-scroll-to-hash/3
I also use classes to smooth scrolling my blog from comment permalink's #hash to targeting the class (I change all commentID to class), not targeting the ID T_T
footer:Still using class. I don't have any idea.
http://jsfiddle.net/tovic/kw7LD/show/#section2
http://jsfiddle.net/tovic/kw7LD/show/#section3
http://jsfiddle.net/tovic/kw7LD/show/#section4
http://jsfiddle.net/tovic/kw7LD/show/#section5
...
here is my javascript file for the entire website http://www.cyberfanatic.com/js/main-all.js
its that long of a js file so should only take 1 mintue to read all the code please tell me what i am doing wrong. as when i insert your code into my website all it does is take the hash away from the url and then jump to the anchor link
What i am saying is your above code only works when the anchor link is like this
Can you make it so the code works like this
A little mind to the design, but it's not my ability to disagree.
at first you had the class set to section1 now you have the href to section one. I don't want the href and nor do i want the class. I want something like this
Any help would be much appreciated. So on page load it will to the anchor link #comehere
$(window).load(function(event) { if (location.hash) {$('html,body').animate({scrollTop: $(location.hash).offset().top -20}, 'slow');} } mid1
may be you got that by this time.