index.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <LayoutNavigation />
  3. <div v-if="shouldShowStickyMenu" id="sticky-menu">
  4. <LayoutUIStickyMenu
  5. :shouldShowStickyMenu="shouldShowStickyMenu"
  6. :squaresData="squaresData"
  7. />
  8. </div>
  9. <HomeCaroussel />
  10. <HomePromotion />
  11. <HomeSolution />
  12. <HomeEventAgenda />
  13. <HomeBesoin />
  14. <HomeReviews />
  15. <!-- <HomeNews /> -->
  16. <HomeHelp />
  17. <LayoutPrefooter id="layout-footer" />
  18. <LayoutFooter id="layout-footer" />
  19. </template>
  20. <script setup>
  21. import { ref, onMounted } from "vue";
  22. import { useRouter } from 'vue-router';
  23. const router = useRouter();
  24. const shouldShowStickyMenu = ref(true);
  25. const squaresData = [
  26. {
  27. id: 1,
  28. bgColor: "green-square",
  29. iconClass: "fa-regular fa-comments icon",
  30. text: "Nous contacter",
  31. url: "/nous-contacter",
  32. },
  33. {
  34. id: 4,
  35. bgColor: "darkblue-square",
  36. iconClass: "fa-solid fa-phone icon",
  37. text: "Nous Appeler"
  38. },
  39. ];
  40. onMounted(() => {
  41. const stickyMenu = document.getElementById("sticky-menu");
  42. const footer = document.getElementById("layout-footer");
  43. const observer = new IntersectionObserver(
  44. ([entry]) => {
  45. shouldShowStickyMenu.value = !entry.isIntersecting;
  46. },
  47. {
  48. root: null,
  49. threshold: 0,
  50. }
  51. );
  52. observer.observe(footer);
  53. });
  54. </script>
  55. <style scoped>
  56. #sticky-menu {
  57. position: sticky;
  58. top: 20rem;
  59. z-index: 1;
  60. margin-bottom: -32rem;
  61. float: right;
  62. }
  63. @media (max-width: 1800px) {
  64. #sticky-menu {
  65. top: 16rem;
  66. margin-bottom: -28rem;
  67. }
  68. }
  69. </style>