Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. var searchBlock = $('.search');
  2.  
  3. $(".pipeline__scroll").on("scroll", function () {
  4.  
  5. $(".pipeline__header-block").each(function () {
  6. this.isFirst = false
  7.  
  8. //является ли этот хэдер первым
  9. if ($(this).is($('.pipeline__currency:nth-of-type(3) .pipeline__header-block'))) {
  10. this.isFirst = true;
  11. }
  12.  
  13. //проверка изпользуется ли поле поиска
  14. if (searchBlock.hasClass('search--sticky')) {
  15. this.topEdge = 44;
  16. } else {
  17. this.topEdge = 1;
  18. }
  19.  
  20. if ($(this).position().top <= this.topEdge) {
  21.  
  22. this.topEdge === 1 ?
  23. $(this).addClass("pipeline__header-block--top") :
  24. $(this).addClass("pipeline__header-block--top-search");
  25. if (!this.isFirst) {
  26. $(this).css("border-top", "none");
  27. }
  28. } else {
  29.  
  30. this.topEdge === 1 ?
  31. $(this).removeClass("pipeline__header-block--top") :
  32. $(this).removeClass("pipeline__header-block--top--search");
  33. if (!this.isFirst) {
  34. $(this).css("border-top", "10px solid #e6e6e6");
  35. }
  36. }
  37. })
  38. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement