smooth-scrolling


Smooth scroll function really slow


I have a script that is supposed to create a smooth scroll down the page when a link is clicked. It works well, but it seems to be very slow the first time it is run on the page. Any suggestions on how to clean this up?
Code
$(function() {
$('a[href*="#"]:not(.carousel-control)').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
&& location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html, body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
}
}
});
});

Related Links

Smooth scroll function really slow
Instagram snapwidget stops the smoothscroll
Listview SmoothScrollToPosition control with buttons and change item background
So smooth scrolling like on this website
One Page Scroll add Active class depending on scroll position
Smooth-Div-Scroll and iPad

Categories

HOME
oop
macros
ns2
oracle-sqldeveloper
ibm
app-store
overrides
mingw
travis-ci-cli
jquery-select2
doctrine2
yacc
ionic-native
digital
mamp
dynamics-crm-2011
loss
openam
ofbiz
alert
django-rest-auth
project-structure
xforms
caldav
spring-webflow
single-page-application
openoffice-basic
fibonacci
symlink
pypy
2checkout
wercker
ports
webclient
webmock
angularjs-resource
odp.net
tunnel
minitest
geocomplete
pymunk
respect-validation
kofax
jibx
delphi-xe
file-descriptor
superclass
cakephp-3.2
runner
dotnet-cli
visualizer
node-java
richtext
disassembly
cardview
sharing
addressbook
class-design
scriptengine
recurring
vitamio
django-celery
jde
phpdesigner
clique
trendline
apache2-module
bluetooth-lowenergy-4.2
github-for-mac
commercetools
redquerybuilder
notice
updating
winforms-interop
polarion
euro
avd
gcc-warning
douglas-peucker
esri-arc-engine
caption
xcode5
launcher
frisby.js
unityvs
qf-test
nsmutableurlrequest
amzi-prolog
reactjs-native
satisfiability
enquire.js
mixradio
starling-framework
data-layers
boofcv
db2-connect
nop
grunt-wiredep
randomaccessfile
ie-developer-tools
wordbreaker
biztalk-deployment
dnsbl
linqdatasource
quit
mail-gem
waveout
blackberry-eclipse-plugin
mvcmailer
eeprom
datejs
apache-commons-email
parallel-python
quazip
javah
numerical-computing
mysql-pconnect
file-storage
djangoappengine
j++

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App