• vue手搓悬浮在线客服按钮


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

  • 相关阅读:
    Qt 之 全局的QNetworkAccessManager
    muduo源码剖析之TcpConnection连接管理
    开发中如何防盗链?
    JVM(8)之从JDK源码级别剖析JVM类加载机制
    Linux内核TCP参数优化
    软考的网络工程师对就业有用吗?
    *** stack smashing detected ***: terminated
    “could not open `CProgram FilesJavajre7libamd64jvm.cfg”问题解决办法
    i18n国际化配置文件配置步骤
    Java中「Future」接口详解
  • 原文地址:https://blog.csdn.net/p_s_p/article/details/140986881