Skip to content

Commit 43459d3

Browse files
committed
Fix: fix the scrolling issue in the footer
1 parent 0ce983c commit 43459d3

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

tutorindigo/templates/indigo/lms/templates/footer.html

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
let primaryColor = "${settings.COLORS['primary']}";
3434
let discoveryUrl = "${settings.MKTG_URLS['ROOT']}" + "/wp-json/edly-wp-routes/footer";
3535

36+
const scrollToTop = () => {
37+
window.scrollTo({ top: 0, behavior: 'smooth' });
38+
};
39+
3640
fetch(discoveryUrl, {
3741
method: 'GET',
3842
credentials: 'include',
@@ -52,7 +56,8 @@
5256
ADD_ATTR: ['target', 'class'],
5357
});
5458
$('#footer-container').html(cleanHtml);
55-
59+
$('#scrollToTop').on('click', scrollToTop);
60+
$('#scrollToTop').hide();
5661
})
5762
.catch(error => {
5863
console.error('Error:', error);
@@ -65,23 +70,16 @@
6570
primaryColor
6671
);
6772
}
68-
69-
const scrollToTop = () => {
70-
window.scrollTo({ top: 0, behavior: 'smooth' });
71-
};
7273
$(window).on('scroll', function() {
7374
if ($(this).scrollTop() > 200){
7475
$('#scrollToTop').fadeIn();
7576
} else {
7677
$('#scrollToTop').fadeOut();
7778
}
7879
});
79-
8080

8181

8282
// Main function start here
83-
$('#scrollToTop').on('click', scrollToTop);
84-
$('#scrollToTop').hide();
8583
updatePrimaryColor();
8684
})
8785
</script>

0 commit comments

Comments
 (0)