账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    html jquery css 做到像手機切換頁面
    40
    0

    請問如何做一個很像手機那種換頁的效果?不使用jquery套件的情況下!如果自己寫的話?有沒有簡單的範本可以參考?比如說按下去就會往右滑這樣

    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 傾旎 普通会员 1楼

      要实现页面的手机切換效果,你可以使用HTML、CSS和jQuery。以下是一个简单的示例:

      HTML: ```html

      Phone Switcher
      Phone
      Tablet
      Desktop

      ```

      CSS (styles.css): ```css .switcher { display: flex; justify-content: center; align-items: center; height: 100vh; }

      .cell { position: relative; display: flex; justify-content: center; align-items: center; height: 100vh; }

      .cell phone { background-color: #007bff; color: white; border-radius: 50%; }

      .cell tablet { background-color: #e04e20; color: white; border-radius: 50%; }

      .cell desktop { background-color: #4CAF50; color: white; border-radius: 50%; }

      .cell phone:hover, .cell tablet:hover, .cell desktop:hover { background-color: #0056b3; } ```

      JavaScript (script.js): javascript $(document).ready(function() { // 检查设备的类型 if ($(window).width() < 600) { $('.switcher .cell').addClass('phone'); } else if ($(window).width() >= 600 && $(window).width() < 900) { $('.switcher .cell').addClass('tablet'); } else if ($(window).width() >= 900) { $('.switcher .cell').addClass('desktop'); } });

      这个示例创建了一个简单的手机切換页面,用户可以通过点击不同的细胞(代表不同的设备类型)来改变页面的显示。当用户触摸屏幕时,页面的背景颜色也会相应地改变,以模仿手机的触摸效果。

    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部