V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Eleflea
V2EX  ›  CSS

怎样实现图片的左右拖动效果

  •  
  •   Eleflea · Apr 20, 2018 · 3874 views
    This topic created in 2935 days ago, the information mentioned may be changed or developed.

    我想展示很多高度不高但宽度很宽的图片,屏幕宽度不能够完全容纳图片。如何让图片以原有的大小显示,当水平拖动图片时能够展现被隐藏的部分(类似于轮播的效果)。与此同时也不影响上下拖动滚动页面。

    之前试过为图片添加 mousedown/mouseup、touchstart/touchend 事件,用 js 控制图片位置,但是感觉没有平滑的效果,对移动端的支持也很麻烦。

    所以有没有更好的方法,或者现成的组件之类的?请各位指教。

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2462 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 07:35 · PVG 15:35 · LAX 00:35 · JFK 03:35
    ♥ Do have faith in what you're doing.