Skip to content

Commit

Permalink
fadein openinghours
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrodevog committed Oct 25, 2023
1 parent b4df856 commit 5a7b4f2
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
14 changes: 14 additions & 0 deletions module/CommonBundle/Resources/assets/common/js/fade.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
$(document).on("scroll", function() {
var pageTop = $(document).scrollTop();
var pageBottom = pageTop + $(window).height();
var tags = $(".tag");

for (var i = 0; i < tags.length; i++) {
var tag = tags[i];
if ($(tag).position().top < pageBottom) {
$(tag).addClass("visible");
} else {
$(tag).removeClass("visible");
}
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,24 @@
margin-bottom: 17px;
}

.fadeElement {
opacity: 0;
transition: all 2.5s;
}

.fadeElement.leftFade {
transform: translate(-30vh, 0);
}

.fadeElement.rightFade {
transform: translate(30vh, 0);
}

.fadeElement.visible {
opacity: 1;
transform: translate(0, 0);
}

.category-title:hover {
color: @color-yellow
}
Expand Down
19 changes: 17 additions & 2 deletions module/CommonBundle/Resources/views/common/index/index.twig
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
<a href="{{ url('cudi_booking') }}" class="btn btn-sm btn-primary">{{ translate('Reservations') }}</a>
</p>
{% endif %} #}
<div class="col-md-6">
<div class="col-md-6 fadeElement leftFade">
<div class="opening_hour_message">
<h2>Cudi - {{ translate('Opening Hours') }}</h2>
{% for message in cudi.messages %}
Expand All @@ -167,7 +167,7 @@
{% endfor %}
</div>
</div>
<div class="col-md-6">
<div class="col-md-6 fadeElement rightFade">
<div class="opening_hour_message">
<h2>Theokot - {{ translate('Opening Hours') }}</h2>
{% for message in shop.messages %}
Expand Down Expand Up @@ -384,6 +384,21 @@
});
});
$(document).on("scroll", function() {
var pageTop = $(document).scrollTop();
var pageBottom = pageTop + $(window).height();
var tags = $(".fadeElement");
for (var i = 0; i < tags.length; i++) {
var tag = tags[i];
if ($(tag).position().top < pageBottom) {
$(tag).addClass("visible");
} else {
$(tag).removeClass("visible");
}
}
});
/* --------------------------
* GLOBAL VARS
* -------------------------- */
Expand Down

0 comments on commit 5a7b4f2

Please sign in to comment.