|
|
|
|
@ -23,6 +23,23 @@ $(document).ready(function () { |
|
|
|
|
$(window).on('scroll', function () { |
|
|
|
|
updateHeader(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$(document).on('click', '[data-banner]', function(e){ |
|
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
|
|
$.ajax('/hide-banner/'+$(this).data('banner'), { |
|
|
|
|
method: 'GET', |
|
|
|
|
}) |
|
|
|
|
.done(function (data) { |
|
|
|
|
if (data.success === true) { |
|
|
|
|
$('.banner').slideUp(); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.fail(function (xhr) { |
|
|
|
|
console.log('error', xhr); |
|
|
|
|
$('.banner').slideUp(); |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
function updateHeader() { |
|
|
|
|
@ -39,13 +56,15 @@ function updateHeader() { |
|
|
|
|
headerElement.removeClass('header--shadow'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(scrollOffset > 0) { |
|
|
|
|
if(scrollOffset <= 140) { |
|
|
|
|
headerElement.css('top', (140-scrollOffset)+'px'); |
|
|
|
|
if($('.banner').is(':visible')) { |
|
|
|
|
if(scrollOffset > 0) { |
|
|
|
|
if(scrollOffset <= 140) { |
|
|
|
|
headerElement.css('top', (140-scrollOffset)+'px'); |
|
|
|
|
} else { |
|
|
|
|
headerElement.css('top', '0px'); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
headerElement.css('top', '0px'); |
|
|
|
|
headerElement.css('top', ''); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
headerElement.css('top', ''); |
|
|
|
|
} |
|
|
|
|
} |