index.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <LayoutNavigation />
  3. <div v-if="shouldShowStickyMenu && !mdAndDown" id="sticky-menu">
  4. <CommonStickyMenu
  5. :shouldShowStickyMenu="shouldShowStickyMenu"
  6. :squaresData="squaresData"
  7. />
  8. </div>
  9. <div v-if="mdAndDown">
  10. <div class="sticky-menu">
  11. <v-btn color="primary">Nous contacter</v-btn>
  12. <v-btn color="secondary">Nous appeler</v-btn>
  13. </div>
  14. </div>
  15. <HomeCaroussel />
  16. <HomePromotion />
  17. <HomeSolution />
  18. <div class="spacer"></div>
  19. <HomeEventAgenda />
  20. <HomeBesoin />
  21. <HomeReviews />
  22. <HomeHelp />
  23. <LayoutFooterPrefooter />
  24. <LayoutFooter id="layout-footer" />
  25. </template>
  26. <script setup>
  27. import { ref, onMounted } from "vue";
  28. import { useRouter } from "vue-router";
  29. import { useDisplay } from "vuetify";
  30. const { mdAndDown } = useDisplay();
  31. const router = useRouter();
  32. const shouldShowStickyMenu = ref(true);
  33. const squaresData = [
  34. {
  35. id: 1,
  36. bgColor: "green-square",
  37. iconClass: "fa-regular fa-comments icon",
  38. text: "Nous contacter",
  39. url: "/nous-contacter",
  40. },
  41. {
  42. id: 4,
  43. bgColor: "darkblue-square",
  44. iconClass: "fa-solid fa-phone icon",
  45. text: "Nous Appeler",
  46. },
  47. ];
  48. onMounted(() => {
  49. const stickyMenu = document.getElementById("sticky-menu");
  50. const footer = document.getElementById("layout-footer");
  51. const observer = new IntersectionObserver(
  52. ([entry]) => {
  53. shouldShowStickyMenu.value = !entry.isIntersecting;
  54. },
  55. {
  56. root: null,
  57. threshold: 0,
  58. }
  59. );
  60. observer.observe(footer);
  61. });
  62. </script>
  63. <style scoped>
  64. .sticky-menu {
  65. position: fixed;
  66. bottom: 0;
  67. width: 100%;
  68. display: flex;
  69. justify-content: center;
  70. background-color: white;
  71. z-index: 100;
  72. }
  73. .spacer {
  74. height: 2rem;
  75. }
  76. #sticky-menu {
  77. position: sticky;
  78. top: 30rem;
  79. z-index: 1;
  80. margin-bottom: -32rem;
  81. float: right;
  82. }
  83. @media (max-width: 1800px) {
  84. #sticky-menu {
  85. top: 26rem;
  86. margin-bottom: -28rem;
  87. }
  88. }
  89. </style>