This repository has been archived by the owner on Jan 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
75 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/** | ||
* Created by yeoman generator-django-ana <%= version %> on <%= date %>. | ||
*/ | ||
jQuery.fn.topLink = function(settings) { | ||
settings = jQuery.extend({ | ||
min: 1, | ||
fadeSpeed: 200 | ||
}, settings); | ||
return this.each(function() { | ||
//listen for scroll | ||
var el = jQuery(this); | ||
el.hide(); //in case the user forgot | ||
jQuery(window).scroll(function() { | ||
if(jQuery(window).scrollTop() >= settings.min) { | ||
el.fadeIn(settings.fadeSpeed); | ||
} | ||
else { | ||
el.fadeOut(settings.fadeSpeed); | ||
} | ||
}); | ||
}); | ||
}; | ||
|
||
$(document).ready(function () { | ||
// Loader | ||
// hide scroll and show on window.load | ||
var loader = $('#loader'); | ||
if (loader.length && loader.css('display') != 'none') $('body').css({overflow: 'hidden'}); | ||
|
||
// Page top | ||
$('#top-link') | ||
// set the link | ||
.topLink({ | ||
min: 400, | ||
fadeSpeed: 500 | ||
}) | ||
// smooth scroll | ||
.click(function (e) { | ||
e.preventDefault(); | ||
$.scrollTo(0, 300); | ||
}); | ||
|
||
// Shrink | ||
if ($('.shrinkable').length) { | ||
$(window).scroll(function () { | ||
if ($(this).scrollTop() > 50) $('.shrinkable').addClass('shrink'); | ||
else $('.shrinkable').removeClass('shrink'); | ||
}); | ||
} | ||
|
||
// Bookmark smooth scroll | ||
$('.nav a[href*="#"]').each(function () { | ||
var bookmark = $(this).attr('href').match(/(#.*)$/g)[0]; | ||
if (bookmark == '#') return; | ||
if (!$(bookmark).length) return; | ||
$(this).on('click', function () { | ||
$.scrollTo(bookmark, 300, {offset: {top: -50, left: 0}}); | ||
}); | ||
}); | ||
|
||
// bootstrap | ||
$('input[type="text"], input[type="number"], input[type="email"], input[type="url"], select') | ||
.addClass('form-control'); | ||
|
||
}); | ||
|
||
$(window).load(function () { | ||
// Loader | ||
// hide loader and show scrollbars (hidden in document.ready) | ||
$('#loader, #loader-container').fadeOut('slow'); | ||
$('body').css({'overflow': 'visible'}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters