Allows for easy implementation of smooth scrolling for same-page links.
Note: Version 2.0+ of this plugin requires jQuery version 1.7 or greater.
Using npm:
Free download EduPro - Professional WordPress Education Theme Nulled. This item was published on themeforest.net and sold by author featherlayers.
The old-fashioned way:
Go to the following URL in your browser and copy/paste the code into your own file:https://raw.githubusercontent.com/kswedberg/jquery-smooth-scroll/master/jquery.smooth-scroll.js
You can try a bare-bones demo at kswedberg.github.io/jquery-smooth-scroll/demo/
$('a').smoothScroll();
$('#container a').smoothScroll();
$('#container a').smoothScroll({excludeWithin: ['.container2']});
$('a').smoothScroll({exclude: ['.rough','#chunky']});
$('.backtotop').smoothScroll({offset: -100});
$('a').smoothScroll({beforeScroll: function() { alert('ready to go!'); }});
$('a').smoothScroll({afterScroll: function() { alert('we made it!'); }});
hashchange
event listener. You can also include a history management plugin such as Ben Alman's BBQ for ancient browser support (IE < 8), but you'll need jQuery 1.8 or earlier. See demo/hashchange.html or demo/bbq.html for an example of how to implement.The following options, shown with their default values, are available for both $.fn.smoothScroll
and $.smoothScroll
:
The options object for $.fn.smoothScroll
can take two additional properties:exclude
and excludeWithin
. The value for both of these is an array ofselectors, DOM elements or jQuery objects. Default value for both is anempty array.
If you need to change any of the options after you've already called .smoothScroll()
,you can do so by passing the 'options'
string as the first argument and anoptions object as the second.
Download MapleStory M on your computer (Windows) or Mac for free. Few details about MapleStory M: Last update of the app is: Review number on is Average review on is The number of download (on the Play Store) on is This app is for Images of MapleStory M Few role playing games who can interest. Discover Your Story! MapleStory delivers legendary MMORPG adventures with boldly original iconic 2D charm. Maplestory Download For Mac Free Full 'MapleStory' is a video game developed by Nexon America. Although your Mac doesn't have the capacity to run the free 'MapleStory' game, you may want to download it anyway for later transfer to a Windows computer. Mac gamers wouldn’t know, as the game has never officially supported macOS/Mac OS X. Don’t get disheartened though, as we’ve found a way for gamers to play MapleStory on Mac – and here’s. /maplestory-mac-download.html.
$.smoothScroll()
document.documentElement
/document.body
)$.smoothScroll
method can take one or two arguments.scrollTarget
option.'+=100px'
or '-=50px'
(see below for an example).The following option, in addition to those listed for $.fn.smoothScroll
above, is availablefor $.smoothScroll
:
.find()
or .next()
..find()
or .next()
.$('html, body').firstScrollable().animate({scrollTop: someNumber}, someSpeed)
With smoothScroll version 2.1 and later, you can use the 'relative string' syntax to scroll an element or the document a certain number of pixels relative to its current position. The following code will scroll the document down one page at a time when the user clicks the '.pagedown' button:
If you want to scroll to an element when the page loads, use $.smoothScroll()
in a script at the end of the body or use $(document).ready()
. To prevent the browser from automatically scrolling to the element on its own, your link on page 1 will need to include a fragment identifier that does not match an element id on page 2. To ensure that users without JavaScript get to the same element, you should modify the link's hash on page 1 with JavaScript. Your script on page 2 will then modify it back to the correct one when you call $.smoothScroll()
.
For example, let's say you want to smooth scroll to <div></div>
on page-2.html. For page-1.html, your script might do the following:
Then for page-2.html, your script would do this:
Imagine you have a link to a form somewhere on the same page. When the user clicks the link, you want the user to be able to begin interacting with that form.
autoFocus
option to true
.autoFocus
set to true by default.$.smoothScroll
method, autoFocus
will only work if you've also provided a value for the scrollTarget
option.afterScroll
callback function. Here is an example that focuses the first input within the form after scrolling to the form:For accessibility reasons, it might make sense to focus any element you scroll to, even if it's not a natively focusable element. To do so, you could add a tabIndex
attribute to the target element (this, again, is for versions prior to 2.2):
$.fn.smoothScroll
method looksfor an element with an id attribute that matches the <a>
element's hash.It does not look at the element's name attribute. If you want a clicked linkto scroll to a 'named anchor' (e.g. <a name='foo'>
), you'll need to use the$.smoothScroll
method instead.$.fn.smoothScroll
and $.smoothScroll
methods use the$.fn.firstScrollable
DOM traversal method (also defined by this plugin)to determine which element is scrollable. If no elements are scrollable,these methods return a jQuery object containing an empty array, just likeall of jQuery's other DOM traversal methods. Any further chained methods,therefore, will be called against no elements (which, in most cases,means that nothing will happen).Thank you! Please consider the following when working on this repo before you submit a pull request:
src/jquery.smooth-scroll.js
.jshint
grunt file options and the .jscsrc
file. To be sure your additions comply, run grunt lint
from the command line.--author
flag to ensure that proper authorship (yours) is maintained.