Skip to content

Commit 28c1e52

Browse files
authored
consulting page scroll bug fix (#795)
* consulting page scroll bug fix * changed that code only affects the consulting page * clean formating consulting index.html * how-we-work consulting page clean formating
1 parent 1d15c4d commit 28c1e52

File tree

5 files changed

+64
-68
lines changed

5 files changed

+64
-68
lines changed

assets/css/pages/consulting.scss

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -685,14 +685,14 @@
685685
}
686686
}
687687
.square-3-wrap {
688-
display: flex;
688+
display: flex;
689689

690-
.multiple-squares {
691-
@media (max-width: $screen-md-max) {
692-
display: none;
690+
.multiple-squares {
691+
@media (max-width: $screen-md-max) {
692+
display: none;
693+
}
693694
}
694695
}
695-
}
696696

697697
.square-4 {
698698
top: -46px;
@@ -727,7 +727,7 @@
727727
justify-content: space-around;
728728
}
729729

730-
.box {
730+
.box-consulting {
731731
position: relative;
732732
opacity: 30%;
733733
max-width: 465px;
@@ -749,7 +749,7 @@
749749
}
750750
}
751751

752-
.box.active {
752+
.box-consulting.active {
753753
opacity: 100%;
754754

755755
@media (max-width: $screen-md-max) {

assets/js/consulting.js

Lines changed: 0 additions & 53 deletions
This file was deleted.

assets/js/main.js

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8543,7 +8543,7 @@ $(function () {
85438543
}
85448544
});
85458545

8546-
$(".question").each(function() {
8546+
$(".question").each(function () {
85478547
if ($(this).find("input:checked").length == 0) {
85488548
showInputError(this);
85498549
isValid = false;
@@ -8624,6 +8624,56 @@ $(function () {
86248624
submitButton.on("click", submitForm);
86258625
});
86268626

8627+
/* Consulting page */
8628+
(function ($) {
8629+
if ($("body.consulting").length) {
8630+
$(window).scroll(function () {
8631+
var scrollTop = $(document).scrollTop() + $(window).height() / 2;
8632+
var positions = [];
8633+
$(".box-consulting").each(function () {
8634+
$(this).removeClass("active");
8635+
positions.push({
8636+
position: $(this).offset().top,
8637+
element: $(this),
8638+
});
8639+
});
8640+
var getClosest = closest(positions, scrollTop);
8641+
getClosest.addClass("active"); // the element closest to the middle of the screen
8642+
8643+
var classList = $(".active").attr("class");
8644+
var classArr = classList.split(/\s+/);
8645+
8646+
$(".box-consulting").each(function () {
8647+
if ($(this).hasClass(classArr[1]) && !$(this).hasClass("active")) {
8648+
$(this).addClass("active");
8649+
}
8650+
});
8651+
8652+
check();
8653+
});
8654+
8655+
function closest(array, number) {
8656+
var num = 0;
8657+
for (var i = array.length - 1; i >= 0; i--) {
8658+
if (
8659+
Math.abs(number - array[i].position) <
8660+
Math.abs(number - array[num].position)
8661+
) {
8662+
num = i;
8663+
}
8664+
}
8665+
return array[num].element;
8666+
}
8667+
8668+
function check() {
8669+
var activeBox = $(".active");
8670+
8671+
$(".square").removeClass("active");
8672+
$(".square-" + activeBox.data("box")).addClass("active");
8673+
}
8674+
}
8675+
})(window.jQuery);
8676+
86278677
/* Ref Arch */
86288678
$("#ref-arch-accordion").on("show.bs.collapse", function (event) {
86298679
$(event.target)

pages/consulting/_how-we-work.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,25 +117,25 @@ <h2>How We Work</h2>
117117
</svg>
118118
</div>
119119
<div class="right-side">
120-
<div class="box box-1 active">
120+
<div class="box-consulting box-1 active">
121121
<h3>Gather requirements</h3>
122122
<p>We work with you to deeply understand the problem you're trying to solve.</p>
123123
</div>
124-
<div class="box box-2">
124+
<div class="box-consulting box-2">
125125
<h3>Put together a proposal</h3>
126126
<p>We put together a plan for the solution we will build.</p>
127127
</div>
128-
<div class="box box-3">
128+
<div class="box-consulting box-3">
129129
<h3>Incremental delivery</h3>
130130
<p>In our proposal, we plan out the work in 2-week sprints with the requirement that we deliver something of
131131
value to you at the end of every single sprint (and not just at the very end of the project).</p>
132132
</div>
133-
<div class="box box-4">
133+
<div class="box-consulting box-4">
134134
<h3>Constant communication</h3>
135135
<p>You get to participate in planning at the start of each sprint and provide feedback on the deliverables at
136136
the end of each sprint.</p>
137137
</div>
138-
<div class="box box-5">
138+
<div class="box-consulting box-5">
139139
<h3>Maintenance & support</h3>
140140
<p>We provide long-term commercial maintenance and support for everything we build.</p>
141141
</div>

pages/consulting/index.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
excerpt: DevOps Consulting. Done Right.
55
permalink: /consulting/
66
slug: consulting
7-
custom_js:
8-
- consulting
7+
98
---
109
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@9/swiper-bundle.min.css" />
1110

0 commit comments

Comments
 (0)