Skip to content

Commit 346bdd1

Browse files
committed
sooth scroll js code added, minor chnage in upload function.
1 parent 0c9201f commit 346bdd1

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

js/uploader.js

+20
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ $(function(){
1717
});
1818
});
1919
function checkProfileSize(arg){
20+
arg = arg || {};
2021
$('#upload-profile-image').attr('src', '');
2122
$('#upload-profile-file-info').html('');
2223
$('#upload-profile-error').html('');
@@ -88,6 +89,7 @@ $(function(){
8889
});
8990
});
9091
function checkProfileSize1(arg){
92+
arg = arg || {};
9193
$('#upload-profile-image-1').attr('src', '');
9294
$('#upload-profile-file-info-1').html('');
9395
$('#upload-profile-error-1').html('');
@@ -160,6 +162,7 @@ $(function(){
160162
});
161163
});
162164
function checkProfileSize2(arg){
165+
arg = arg || {};
163166
$('#upload-profile-image-2').attr('src', '');
164167
$('#upload-profile-file-info-2').html('');
165168
$('#upload-profile-error-2').html('');
@@ -318,5 +321,22 @@ $(function(){
318321
hideTooltip($(this));
319322
});
320323

324+
});
321325

326+
// To smooth scroll hash
327+
$(function(){
328+
$("nav ul li a[href^='#']").on('click', function(e) {
329+
// prevent default anchor click behavior
330+
e.preventDefault();
331+
// store hash
332+
var hash = this.hash;
333+
// animate
334+
$('html, body').animate({
335+
scrollTop: $(hash).offset().top
336+
}, 500, function(){
337+
// when done, add hash to url
338+
// (default click behaviour)
339+
window.location.hash = hash;
340+
});
341+
});
322342
});

0 commit comments

Comments
 (0)