|
|
@@ -39,5 +39,38 @@ $(document).ready(function () {
|
|
|
e.preventDefault();
|
|
|
$("#searchForm").toggleClass('header-search--active')
|
|
|
});
|
|
|
+
|
|
|
+ (function($){
|
|
|
+ var body = $('html, body');
|
|
|
+ var getScroll = function() {
|
|
|
+ return $('body').scrollTop() || $('html').scrollTop();
|
|
|
+ };
|
|
|
+ if(body.height() > window.outerHeight && body.width() > 1023) {
|
|
|
+ var button = $('<div class="go-top-link"></div>')
|
|
|
+ .css({
|
|
|
+ 'position': 'fixed',
|
|
|
+ 'bottom': '30px',
|
|
|
+ 'left': '30px'
|
|
|
+ }).click(function(){
|
|
|
+ body.animate({'scrollTop': 0});
|
|
|
+ }).hide();
|
|
|
+ body.append(button);
|
|
|
+ var isShown = false;
|
|
|
+ var scrollToShow = 400;
|
|
|
+ if(getScroll() >= scrollToShow) {
|
|
|
+ button.fadeIn();
|
|
|
+ isShown = true;
|
|
|
+ }
|
|
|
+ $(window).on('scroll', function(){
|
|
|
+ if(getScroll() >= scrollToShow && !isShown) {
|
|
|
+ button.stop().fadeIn();
|
|
|
+ isShown = true;
|
|
|
+ } else if(getScroll() < scrollToShow && isShown) {
|
|
|
+ button.stop().fadeOut();
|
|
|
+ isShown = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })($)
|
|
|
});
|
|
|
|