Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var searchBlock = $('.search');
- $(".pipeline__scroll").on("scroll", function () {
- $(".pipeline__header-block").each(function () {
- this.isFirst = false
- //является ли этот хэдер первым
- if ($(this).is($('.pipeline__currency:nth-of-type(3) .pipeline__header-block'))) {
- this.isFirst = true;
- }
- //проверка изпользуется ли поле поиска
- if (searchBlock.hasClass('search--sticky')) {
- this.topEdge = 44;
- } else {
- this.topEdge = 1;
- }
- if ($(this).position().top <= this.topEdge) {
- this.topEdge === 1 ?
- $(this).addClass("pipeline__header-block--top") :
- $(this).addClass("pipeline__header-block--top-search");
- if (!this.isFirst) {
- $(this).css("border-top", "none");
- }
- } else {
- this.topEdge === 1 ?
- $(this).removeClass("pipeline__header-block--top") :
- $(this).removeClass("pipeline__header-block--top--search");
- if (!this.isFirst) {
- $(this).css("border-top", "10px solid #e6e6e6");
- }
- }
- })
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement