Make skip-scrolling to target href a reusable function.
This commit is contained in:
@ -768,6 +768,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
serendipity.skipScroll = function(target, time) {
|
||||||
|
time = typeof time !== 'undefined' ? time : 250;
|
||||||
|
|
||||||
|
$('html, body').animate({
|
||||||
|
scrollTop: $(target).offset().top
|
||||||
|
}, time);
|
||||||
|
}
|
||||||
|
|
||||||
}( window.serendipity = window.serendipity || {}, jQuery ))
|
}( window.serendipity = window.serendipity || {}, jQuery ))
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
@ -948,11 +956,8 @@ $(function() {
|
|||||||
$('#select_category').click(function(e) {
|
$('#select_category').click(function(e) {
|
||||||
$('#toggle_metadata').click();
|
$('#toggle_metadata').click();
|
||||||
|
|
||||||
// We might want to make this reuseable
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$('html, body').animate({
|
serendipity.skipScroll($(this).attr('href'));
|
||||||
scrollTop: $($(this).attr('href')).offset().top
|
|
||||||
}, 1000);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
{else}
|
{else}
|
||||||
@ -987,11 +992,8 @@ $(function() {
|
|||||||
$('#select_tags').click(function(e) {
|
$('#select_tags').click(function(e) {
|
||||||
$('#toggle_advanced').click();
|
$('#toggle_advanced').click();
|
||||||
|
|
||||||
// We might want to make this reuseable
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$('html, body').animate({
|
serendipity.skipScroll($(this).attr('href'));
|
||||||
scrollTop: $($(this).attr('href')).offset().top
|
|
||||||
}, 1000);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
{else}
|
{else}
|
||||||
@ -1204,11 +1206,8 @@ $(function() {
|
|||||||
$('.toggle_links').click(function(e) {
|
$('.toggle_links').click(function(e) {
|
||||||
$('#s9y_links').toggleClass('mfp-hide');
|
$('#s9y_links').toggleClass('mfp-hide');
|
||||||
|
|
||||||
// We might want to make this reuseable
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$('html, body').animate({
|
serendipity.skipScroll($(this).attr('href'));
|
||||||
scrollTop: $($(this).attr('href')).offset().top
|
|
||||||
}, 1000);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
{else}
|
{else}
|
||||||
|
Reference in New Issue
Block a user