vue手搓悬浮在线客服按钮

种地  金牌会员 | 2024-8-12 04:38:50 | 显示全部楼层 | 阅读模式
打印 上一主题 下一主题

主题 555|帖子 555|积分 1665

  1. <template>
  2.   <div id="app">
  3.   <Header></Header>
  4.     <!-- 悬浮按钮 -->
  5.     <div class="floating-module">
  6.         <button class="floating-button" id="online-service" @click="kefu()">
  7.             <img src="@/assets/icon/客服.png" alt="在线客服">
  8.         </button>
  9.         <button class="floating-button" id="phone-service" @click="dianhua()">
  10.             <img src="@/assets/icon/电话.png" alt="电话咨询">
  11.         </button>
  12.     </div>
  13.     <!-- 路由挂载 -->
  14.     <router-view></router-view>
  15.   <Footer></Footer>
  16.   </div>
  17. </template>
  18. <script>
  19. import Header from '@/components/Header/Header'
  20. import Footer from '@/components/Footer/Footer'
  21. export default {
  22.   name: 'App',
  23.   components: {
  24.     Header,
  25.     Footer
  26.   },
  27.   methods:{
  28.     kefu(){
  29.       alert('客服')
  30.     },
  31.     dianhua(){
  32.       alert('电话')
  33.     }
  34.   }
  35. }
  36. </script>
  37. <style>
  38. #app {
  39.   font-family: Avenir, Helvetica, Arial, sans-serif;
  40.   -webkit-font-smoothing: antialiased;
  41.   -moz-osx-font-smoothing: grayscale;
  42.   /* text-align: center; */
  43.   /* color: #2c3e50; */
  44.   /* margin-top: 60px; */
  45.   /* padding-top:100px; */
  46. }
  47. a{
  48.   text-decoration: none;
  49.   color: #000000;
  50. }
  51. li{
  52.   list-style: none;
  53. }
  54. *{
  55.   margin: 0;
  56.   padding: 0;
  57. }
  58. @media screen and (max-width:768px) {
  59.   /* #app {
  60.     padding-top:200px;
  61.   } */
  62. }
  63. .floating-module {
  64.             position: fixed;
  65.             right: 10px;
  66.             top: 50%;
  67.             transform: translateY(-50%);
  68.             display: flex;
  69.             flex-direction: column;
  70.             align-items: center;
  71.             z-index: 999;
  72.         }
  73.         .floating-button {
  74.             width: 50px;
  75.             height: 50px;
  76.             background-color: #ffffff;
  77.             color: white;
  78.             border: none;
  79.             border-radius: 50%;
  80.             margin: 5px 0;
  81.             display: flex;
  82.             align-items: center;
  83.             justify-content: center;
  84.             cursor: pointer;
  85.             box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
  86.             transition: background-color 0.3s, transform 0.3s;
  87.         }
  88.         .floating-button:hover {
  89.             background-color: #4095e5;
  90.             transform: scale(1.1);
  91.         }
  92.         .floating-button img {
  93.             width: 50%;
  94.             height: 50%;
  95.         }
  96. </style>
复制代码


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

种地

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表